Skip to content

Commit

Permalink
Fix socket reinitialization for ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
resetius committed Dec 11, 2023
1 parent 6681824 commit 61c5d87
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,18 @@ void TNode<TSocket>::Connect() {
if (Connector && Connector.done()) {
Connector.destroy();
}

Socket = SocketFactory(*Address);
Connected = false;
Connector = DoConnect();
}
}

template<typename TSocket>
NNet::TVoidSuspendedTask TNode<TSocket>::DoConnect() {
std::cout << "Connecting " << Name << "\n";
Connected = false;
while (!Connected) {
try {
auto deadline = NNet::TClock::now() + std::chrono::milliseconds(100); // TODO: broken timeout in coroio
Socket = SocketFactory(*Address);
co_await Socket.Connect(deadline);
std::cout << "Connected " << Name << "\n";
Connected = true;
Expand Down

0 comments on commit 61c5d87

Please sign in to comment.