fixed possible crash when connection was destructed while it was still busy resolving the domain name

This commit is contained in:
Emiel Bruijntjes 2015-11-10 15:29:25 +01:00
parent 1370afee94
commit 41b07672e0
1 changed files with 3 additions and 3 deletions

View File

@ -152,6 +152,9 @@ public:
{
// stop monitoring the pipe filedescriptor
_handler->monitor(_connection, _pipe.in(), 0);
// wait for the thread to be ready
_thread.join();
}
/**
@ -165,9 +168,6 @@ public:
// only works if the incoming pipe is readable
if (fd != _pipe.in() || !(flags & readable)) return this;
// wait for the thread to be ready
_thread.join();
// do we have a valid socket?
if (_socket >= 0) return new TcpConnected(_connection, _socket, std::move(_buffer), _handler);