connection_manager.cpp 751 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // connection_manager.cpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 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 "connection_manager.hpp"
  11. namespace http {
  12. namespace server {
  13. connection_manager::connection_manager()
  14. {
  15. }
  16. void connection_manager::start(connection_ptr c)
  17. {
  18. connections_.insert(c);
  19. c->start();
  20. }
  21. void connection_manager::stop(connection_ptr c)
  22. {
  23. connections_.erase(c);
  24. c->stop();
  25. }
  26. void connection_manager::stop_all()
  27. {
  28. for (auto c: connections_)
  29. c->stop();
  30. connections_.clear();
  31. }
  32. } // namespace server
  33. } // namespace http