AppChat  0.5.0
TCP client-server caht application with boost::asio library.
connection_manager.h
1 #ifndef CONNECTIONMANAGER_H
2 #define CONNECTIONMANAGER_H
3 
4 #include "connection.h"
5 
11 {
12 public:
13  ConnectionManager(database_ptr db): db(db) {
14  BOOST_LOG_TRIVIAL(info) << "create ConnectionManager";
15  }
16  ConnectionManager(const ConnectionManager&) = delete;
17 
22  connection_ptr get_connection(boost::asio::ip::tcp::socket&& _socket);
23 
25  for (auto& value_con: pool_connections) {
26  value_con->set_busy(false);
27  }
28  pool_connections.clear();
29  }
30 private:
31  std::vector<connection_ptr> pool_connections;
32  database_ptr db;
33 
37  void print_pool() const noexcept;
38 };
39 
40 #endif // CONNECTIONMANAGER_H
ConnectionManager.
Definition: connection_manager.h:10
connection_ptr get_connection(boost::asio::ip::tcp::socket &&_socket)
get new or old connection for new client
Definition: connection_manager.cpp:4