Loading src/ssl.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include "exception.h" #include "socket.h" #include "eventapi.h" namespace netplus { Loading Loading @@ -128,6 +129,7 @@ void ssl::connect(const std::string& addr, int port, bool nonblock) { // with a timeout to prevent indefinite hangs on dead peers. // For non-blocking, the caller (e.g. epoll event loop) will drive it. if (!nonblock) { socketwait sw; auto deadline = std::chrono::steady_clock::now() + std::chrono::seconds(15); while (!_tls.getHandshakeDone()) { if (std::chrono::steady_clock::now() >= deadline) { Loading @@ -140,7 +142,16 @@ void ssl::connect(const std::string& addr, int port, bool nonblock) { _tls.flush_out(); } // Drive the handshake state machine try { _tls.handshake_after_connect(); } catch (NetException &e) { if (e.getErrorType() == NetException::Note) { // Need more data from peer - wait for socket readability sw.waitRead(*this, 100); continue; } throw; } } } } Loading Loading
src/ssl.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include "exception.h" #include "socket.h" #include "eventapi.h" namespace netplus { Loading Loading @@ -128,6 +129,7 @@ void ssl::connect(const std::string& addr, int port, bool nonblock) { // with a timeout to prevent indefinite hangs on dead peers. // For non-blocking, the caller (e.g. epoll event loop) will drive it. if (!nonblock) { socketwait sw; auto deadline = std::chrono::steady_clock::now() + std::chrono::seconds(15); while (!_tls.getHandshakeDone()) { if (std::chrono::steady_clock::now() >= deadline) { Loading @@ -140,7 +142,16 @@ void ssl::connect(const std::string& addr, int port, bool nonblock) { _tls.flush_out(); } // Drive the handshake state machine try { _tls.handshake_after_connect(); } catch (NetException &e) { if (e.getErrorType() == NetException::Note) { // Need more data from peer - wait for socket readability sw.waitRead(*this, 100); continue; } throw; } } } } Loading