Skip to content

Commit

Permalink
Remove client node from Nodes on connection close
Browse files Browse the repository at this point in the history
  • Loading branch information
resetius committed Dec 16, 2023
1 parent 902c6af commit 3e908e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ NNet::TVoidSuspendedTask TNode<TSocket>::DoConnect() {

template<typename TSocket>
NNet::TVoidTask TRaftServer<TSocket>::InboundConnection(TSocket socket) {
std::shared_ptr<TNode<TSocket>> client;
try {
auto client = std::make_shared<TNode<TSocket>>(
client = std::make_shared<TNode<TSocket>>(
"client", std::move(socket), TimeSource
);
Nodes.insert(client);
Expand All @@ -128,6 +129,7 @@ NNet::TVoidTask TRaftServer<TSocket>::InboundConnection(TSocket socket) {
} catch (const std::exception & ex) {
std::cerr << "Exception: " << ex.what() << "\n";
}
Nodes.erase(client);
co_return;
}

Expand Down

0 comments on commit 3e908e2

Please sign in to comment.