diff options
Diffstat (limited to 'network-handler/networkhandler.cpp')
| -rw-r--r-- | network-handler/networkhandler.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/network-handler/networkhandler.cpp b/network-handler/networkhandler.cpp index 8c5997f..4b1926d 100644 --- a/network-handler/networkhandler.cpp +++ b/network-handler/networkhandler.cpp @@ -18,10 +18,11 @@ NetworkHandler::NetworkHandler(const ListenSettings& listen_settings) , clients() { auto accept_handler = [this](tcp::socket&& socket) { - clients.push_back(Client(std::move(socket))); + clients.emplace_back(std::move(socket)); + auto it = --clients.end(); - clients.back().set_on_done( + clients.back().on_done( [this, it]() { clients.erase(it); } |
