GH #136: EchoServer issue.

This commit is contained in:
Aleksandar Fabijanic 2013-03-23 23:44:53 -05:00
parent cbb17638a7
commit 3abf1cc73c

View File

@ -131,9 +131,13 @@ public:
void onSocketReadable(const AutoPtr<ReadableNotification>& pNf)
{
// receive bytes and transfer(echo) them to the output FIFO buffer
int len = _socket.receiveBytes(_fifoIn);
_fifoIn.drain(_fifoOut.write(_fifoIn.buffer()));
// some socket implementations (windows) report available
// bytes on client disconnect, so we double-check here
if (_socket.available())
{
int len = _socket.receiveBytes(_fifoIn);
_fifoIn.drain(_fifoOut.write(_fifoIn.buffer()));
}
}
void onSocketWritable(const AutoPtr<WritableNotification>& pNf)