valid file descriptors that can be closed are >= 0

This commit is contained in:
Michael van der Werve 2020-05-08 13:30:08 +02:00
parent ab0a292a0e
commit 1c08399ab0
1 changed files with 1 additions and 1 deletions

View File

@ -42,7 +42,7 @@ TcpConnection::~TcpConnection() noexcept
// remain open (tcp connection is forcefully closed). since we assume the handler is in scope for
// the complete lifetime of the tcpconnection, we make one last call to notify it to unmonitor
// the file descriptor.
if (fileno() > 0) _handler->monitor(this, fileno(), 0);
if (fileno() >= 0) _handler->monitor(this, fileno(), 0);
// When the object is destructed, the _state-pointer will also destruct, resulting
// in some final calls back to us to inform that the connection has indeed been closed.