| src/examples/cpp03/http/server/connection_manager.hpp | src/examples/cpp11/http/server/connection_manager.hpp | 
|---|
| ⋮ | ⋮ | 
| 1 | // | 1 | // | 
| 2 | //·connection_manager.hpp | 2 | //·connection_manager.hpp | 
| 3 | //·~~~~~~~~~~~~~~~~~~~~~~ | 3 | //·~~~~~~~~~~~~~~~~~~~~~~ | 
| 4 | // | 4 | // | 
| 5 | //·Copyright·(c)·2003-2021·Christopher·M.·Kohlhoff·(chris·at·kohlhoff·dot·com) | 5 | //·Copyright·(c)·2003-2021·Christopher·M.·Kohlhoff·(chris·at·kohlhoff·dot·com) | 
| 6 | // | 6 | // | 
| 7 | //·Distributed·under·the·Boost·Software·License,·Version·1.0.·(See·accompanying | 7 | //·Distributed·under·the·Boost·Software·License,·Version·1.0.·(See·accompanying | 
| 8 | //·file·LICENSE_1_0.txt·or·copy·at·http://www.boost.org/LICENSE_1_0.txt) | 8 | //·file·LICENSE_1_0.txt·or·copy·at·http://www.boost.org/LICENSE_1_0.txt) | 
| 9 | // | 9 | // | 
| 10 |  | 10 |  | 
| 11 | #ifndef·HTTP_CONNECTION_MANAGER_HPP | 11 | #ifndef·HTTP_CONNECTION_MANAGER_HPP | 
| 12 | #define·HTTP_CONNECTION_MANAGER_HPP | 12 | #define·HTTP_CONNECTION_MANAGER_HPP | 
| 13 |  | 13 |  | 
| 14 | #include·<set> | 14 | #include·<set> | 
| 15 | #include·<boost/noncopyable.hpp> |  | 
| 16 | #include·"connection.hpp" | 15 | #include·"connection.hpp" | 
| 17 |  | 16 |  | 
| 18 | namespace·http·{ | 17 | namespace·http·{ | 
| 19 | namespace·server·{ | 18 | namespace·server·{ | 
| 20 |  | 19 |  | 
| 21 | ///·Manages·open·connections·so·that·they·may·be·cleanly·stopped·when·the·server | 20 | ///·Manages·open·connections·so·that·they·may·be·cleanly·stopped·when·the·server | 
| 22 | ///·needs·to·shut·down. | 21 | ///·needs·to·shut·down. | 
| 23 | class·connection_manager | 22 | class·connection_manager | 
| 24 | ··:·private·boost::noncopyable |  | 
| 25 | { | 23 | { | 
| 26 | public: | 24 | public: | 
|  | 25 | ··connection_manager(const·connection_manager&)·=·delete; | 
|  | 26 | ··connection_manager&·operator=(const·connection_manager&)·=·delete; | 
|  | 27 |  | 
|  | 28 | ··///·Construct·a·connection·manager. | 
|  | 29 | ··connection_manager(); | 
|  | 30 |  | 
| 27 | ··///·Add·the·specified·connection·to·the·manager·and·start·it. | 31 | ··///·Add·the·specified·connection·to·the·manager·and·start·it. | 
| 28 | ··void·start(connection_ptr·c); | 32 | ··void·start(connection_ptr·c); | 
| 29 |  | 33 |  | 
| 30 | ··///·Stop·the·specified·connection. | 34 | ··///·Stop·the·specified·connection. | 
| 31 | ··void·stop(connection_ptr·c); | 35 | ··void·stop(connection_ptr·c); | 
| 32 |  | 36 |  | 
| 33 | ··///·Stop·all·connections. | 37 | ··///·Stop·all·connections. | 
| 34 | ··void·stop_all(); | 38 | ··void·stop_all(); | 
| 35 |  | 39 |  | 
| 36 | private: | 40 | private: | 
| 37 | ··///·The·managed·connections. | 41 | ··///·The·managed·connections. | 
| 38 | ··std::set<connection_ptr>·connections_; | 42 | ··std::set<connection_ptr>·connections_; | 
| 39 | }; | 43 | }; | 
| 40 |  | 44 |  | 
| 41 | }·//·namespace·server | 45 | }·//·namespace·server | 
| 42 | }·//·namespace·http | 46 | }·//·namespace·http | 
| 43 |  | 47 |  | 
| 44 | #endif·//·HTTP_CONNECTION_MANAGER_HPP | 48 | #endif·//·HTTP_CONNECTION_MANAGER_HPP |