Implemented buffering for asynchronous sockets.

This commit is contained in:
Dominik Picheta 2014-04-13 14:18:47 +01:00
commit 3612aca5fe
3 changed files with 38 additions and 4 deletions

View file

@ -381,8 +381,8 @@ when defined(windows) or defined(nimdoc):
let err = osLastError()
if err.int32 != ERROR_IO_PENDING:
dealloc dataBuf.buf
retFuture.fail(newException(EOS, osErrorMsg(err)))
dealloc(ol)
retFuture.fail(newException(EOS, osErrorMsg(err)))
elif ret == 0 and bytesReceived == 0 and dataBuf.buf[0] == '\0':
# We have to ensure that the buffer is empty because WSARecv will tell
# us immediatelly when it was disconnected, even when there is still