From 1c1467f51b6dda92dec974eb59026c2c5ba79ed6 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Wed, 7 Apr 2021 13:47:58 +0200 Subject: [PATCH] i2p: cancel the Accept() method if waiting on the socket errors --- src/i2p.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/i2p.cpp b/src/i2p.cpp index a44f09f0436..2ae164633b9 100644 --- a/src/i2p.cpp +++ b/src/i2p.cpp @@ -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.