fixed bad disconnect handling in onSocketReadable

This commit is contained in:
Guenter Obiltschnig 2016-10-07 21:54:20 +02:00
parent cdb2195ed3
commit 9b10c24b61

View File

@ -111,13 +111,15 @@ public:
void onSocketReadable(const AutoPtr<ReadableNotification>& pNf)
{
// some socket implementations (windows) report available
// bytes on client disconnect, so we double-check here
if (_socket.available())
int len = _socket.receiveBytes(_fifoIn);
if (len > 0)
{
int len = _socket.receiveBytes(_fifoIn);
_fifoIn.drain(_fifoOut.write(_fifoIn.buffer(), _fifoIn.used()));
}
else
{
delete this;
}
}
void onSocketWritable(const AutoPtr<WritableNotification>& pNf)