diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-03-24 21:50:37 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-03-24 21:50:37 +0000 |
commit | ca2ba680bb5d112eccc1a152704945d89db8c733 (patch) | |
tree | a525b1b0619335c9070a41a05d688fbbc38a5108 /lib | |
parent | 7cc40f79b9c0297956358bb8aa401110b52c9f6b (diff) |
Reinitialise the OVERLAPPED structure each time we start a new overlapped
read. Thanks to Charles Lecklider for pointing this out. (refs #3, merges
part of [1458])
Diffstat (limited to 'lib')
-rw-r--r-- | lib/server/WinNamedPipeStream.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/server/WinNamedPipeStream.cpp b/lib/server/WinNamedPipeStream.cpp index e4a675a7..6ef174c8 100644 --- a/lib/server/WinNamedPipeStream.cpp +++ b/lib/server/WinNamedPipeStream.cpp @@ -298,6 +298,13 @@ int WinNamedPipeStream::Read(void *pBuffer, int NBytes, int Timeout) mBytesInBuffer = BytesRemaining; NumBytesRead = BytesToCopy; + if (needAnotherRead) + { + // reinitialise the OVERLAPPED structure + memset(&mReadOverlap, 0, sizeof(mReadOverlap)); + mReadOverlap.hEvent = mReadableEvent; + } + // start the next overlapped read if (needAnotherRead && !ReadFile(mSocketHandle, mReadBuffer + mBytesInBuffer, |