Skip to content

Commit

Permalink
i2p: cancel the Accept() method if waiting on the socket errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vasild committed Apr 8, 2021
1 parent aa69471 commit 1c1467f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/i2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ bool Session::Accept(Connection& conn)
try {
while (!*m_interrupt) {
Sock::Event occurred;
conn.sock->Wait(MAX_WAIT_FOR_IO, Sock::RECV, &occurred);
if (!conn.sock->Wait(MAX_WAIT_FOR_IO, Sock::RECV, &occurred)) {
throw std::runtime_error("wait on socket failed");
}

if ((occurred & Sock::RECV) == 0) {
// Timeout, no incoming connections within MAX_WAIT_FOR_IO.
Expand Down

0 comments on commit 1c1467f

Please sign in to comment.