asio 0.3.7 Home | Reference | Tutorial | Examples | Design
Examples

http::server::connection_manager Class Reference

Inherits noncopyable.

Collaboration diagram for http::server::connection_manager:

Collaboration graph
List of all members.

Detailed Description

Manages open connections so that they may be cleanly stopped when the server needs to shut down.

Definition at line 12 of file connection_manager.hpp.

Public Member Functions

void start (connection_ptr c)
 Add the specified connection to the manager and start it.
void stop (connection_ptr c)
 Stop the specified connection.
void stop_all ()
 Stop all connections.

Private Attributes

std::set< connection_ptrconnections_
 The managed connections.


Member Function Documentation

void http::server::connection_manager::start ( connection_ptr  c  ) 

Add the specified connection to the manager and start it.

Definition at line 8 of file connection_manager.cpp.

Referenced by http::server::server::handle_accept().

00009 {
00010   connections_.insert(c);
00011   c->start();
00012 }

void http::server::connection_manager::stop ( connection_ptr  c  ) 

Stop the specified connection.

Definition at line 14 of file connection_manager.cpp.

Referenced by http::server::connection::handle_read(), and http::server::connection::handle_write().

00015 {
00016   connections_.erase(c);
00017   c->stop();
00018 }

void http::server::connection_manager::stop_all (  ) 

Stop all connections.

Definition at line 20 of file connection_manager.cpp.

Referenced by http::server::server::handle_stop().

00021 {
00022   std::for_each(connections_.begin(), connections_.end(),
00023       boost::bind(&connection::stop, _1));
00024   connections_.clear();
00025 }


Member Data Documentation

std::set<connection_ptr> http::server::connection_manager::connections_ [private]

The managed connections.

Definition at line 27 of file connection_manager.hpp.

Referenced by start(), stop(), and stop_all().


The documentation for this class was generated from the following files:
asio 0.3.7 Home | Reference | Tutorial | Examples | Design