asio 0.3.8rc3 | Home | Reference | Tutorial | Examples | Design

Examples |

# http::server::connection_manager Class Reference

Inherits noncopyable.

Collaboration diagram for http::server::connection_manager:

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 22 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_ptr > | connections_
| 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 18 of file connection_manager.cpp.

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

    00019 {
    00020   connections_.insert(c);
    00021   c->start();
    00022 }

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

Stop the specified connection.

Definition at line 24 of file connection_manager.cpp.

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

    00025 {
    00026   connections_.erase(c);
    00027   c->stop();
    00028 }

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

Stop all connections.

Definition at line 30 of file connection_manager.cpp.

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

    00031 {
    00032   std::for_each(connections_.begin(), connections_.end(),
    00033       boost::bind(&connection::stop, _1));
    00034   connections_.clear();
    00035 }

## Member Data Documentation

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

The managed connections.

Definition at line 37 of file connection_manager.hpp.

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

The documentation for this class was generated from the following files:

- http/server/connection_manager.hpp
- http/server/connection_manager.cpp

asio 0.3.8rc3 | Home | Reference | Tutorial | Examples | Design