connection_manager.cc 797 B

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // connection_manager.cpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2010 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. #include <algorithm>
  11. #include <boost/bind.hpp>
  12. #include "Experimental/http_server/connection_manager.h"
  13. namespace http_server {
  14. void connection_manager::start(connection_ptr c)
  15. {
  16. connections_.insert(c);
  17. c->start();
  18. }
  19. void connection_manager::stop(connection_ptr c)
  20. {
  21. connections_.erase(c);
  22. c->stop();
  23. }
  24. void connection_manager::stop_all()
  25. {
  26. std::for_each(connections_.begin(), connections_.end(), boost::bind(
  27. &connection::stop, _1));
  28. connections_.clear();
  29. }
  30. } // namespace http_server