Zhenkai Zhu | a9a7e1d | 2013-02-25 18:29:07 -0800 | [diff] [blame] | 1 | // |
| 2 | // connection_manager.cpp |
| 3 | // ~~~~~~~~~~~~~~~~~~~~~~ |
| 4 | // |
| 5 | // Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) |
| 6 | // |
| 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) |
| 9 | // |
| 10 | |
| 11 | #include "connection_manager.hpp" |
| 12 | #include <algorithm> |
| 13 | #include <boost/bind.hpp> |
| 14 | |
| 15 | namespace http { |
| 16 | namespace server { |
| 17 | |
| 18 | void connection_manager::start(connection_ptr c) |
| 19 | { |
| 20 | connections_.insert(c); |
| 21 | c->start(); |
| 22 | } |
| 23 | |
| 24 | void connection_manager::stop(connection_ptr c) |
| 25 | { |
| 26 | connections_.erase(c); |
| 27 | c->stop(); |
| 28 | } |
| 29 | |
| 30 | void connection_manager::stop_all() |
| 31 | { |
| 32 | std::for_each(connections_.begin(), connections_.end(), |
| 33 | boost::bind(&connection::stop, _1)); |
| 34 | connections_.clear(); |
| 35 | } |
| 36 | |
| 37 | } // namespace server |
| 38 | } // namespace http |