Skip to content

Commit 1c1467f

Browse files
committed
i2p: cancel the Accept() method if waiting on the socket errors
1 parent aa69471 commit 1c1467f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/i2p.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ bool Session::Accept(Connection& conn)
147147
try {
148148
while (!*m_interrupt) {
149149
Sock::Event occurred;
150-
conn.sock->Wait(MAX_WAIT_FOR_IO, Sock::RECV, &occurred);
150+
if (!conn.sock->Wait(MAX_WAIT_FOR_IO, Sock::RECV, &occurred)) {
151+
throw std::runtime_error("wait on socket failed");
152+
}
151153

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

0 commit comments

Comments
 (0)