26#ifndef ROUTING_SOCKETCONTAINER_INCLUDED
27#define ROUTING_SOCKETCONTAINER_INCLUDED
39template <
class Protocol>
56 std::lock_guard<std::mutex> lk(
mtx_);
68 template <
class... Args>
70 std::lock_guard<std::mutex> lk(
mtx_);
72 sockets_.emplace_back(std::forward<Args>(args)...);
85 std::lock_guard<std::mutex> lk(
mtx_);
92 if (cur->native_handle() == client_sock.native_handle()) {
93 auto sock = std::move(*cur);
100 return socket_type{client_sock.get_executor().context()};
105 std::lock_guard<std::mutex> lk(
mtx_);
115 std::lock_guard<std::mutex> lk(
mtx_);
126 std::lock_guard<std::mutex> lk(
mtx_);
134 std::lock_guard<std::mutex> lk(
mtx_);
Definition: protocol.h:33
container of sockets.
Definition: socket_container.h:40
std::list< socket_type > container_type
Definition: socket_container.h:48
bool empty() const
check if the container is empty.
Definition: socket_container.h:125
auto run(F &&f)
Definition: socket_container.h:104
socket_type & push_back(socket_type &&sock)
move ownership of socket_type to the container.
Definition: socket_container.h:55
socket_type release(socket_type &client_sock)
release socket from container.
Definition: socket_container.h:84
container_type sockets_
Definition: socket_container.h:139
socket_type & emplace_back(Args &&... args)
move ownership of socket_type to the container.
Definition: socket_container.h:69
size_t size() const
get size of container.
Definition: socket_container.h:133
void disconnect_all()
disconnect all sockets.
Definition: socket_container.h:114
typename protocol_type::socket socket_type
Definition: socket_container.h:43
socket_type release_unlocked(socket_type &client_sock)
Definition: socket_container.h:90
std::mutex mtx_
Definition: socket_container.h:141
static MYSQL * sock
Definition: mysqlcheck.cc:56
stdx::expected< native_handle_type, error_type > socket(int family, int sock_type, int protocol)
Definition: socket.h:63