i2p: cancel the Accept() method if waiting on the socket errors

This commit is contained in:
Vasil Dimov 2021-04-07 13:47:58 +02:00
parent aa69471ecd
commit 1c1467f51b
No known key found for this signature in database
GPG key ID: 54DF06F64B55CBBF

View file

@ -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.