summaryrefslogtreecommitdiff
path: root/lib/server/WinNamedPipeStream.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-12-28 22:03:33 +0000
committerChris Wilson <chris+github@qwirx.com>2014-12-28 22:03:33 +0000
commita36fc86490fd4eeb70094990008aff323882412a (patch)
tree60d669e968acd9e722b4c948784657fbf840fdfc /lib/server/WinNamedPipeStream.cpp
parent7b7456c31276011f012ae7d9f02437ae31071c8c (diff)
Whitespace and comment fixes.
Improve correctness and reduce code duplication in bbackupctl.
Diffstat (limited to 'lib/server/WinNamedPipeStream.cpp')
-rw-r--r--lib/server/WinNamedPipeStream.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/server/WinNamedPipeStream.cpp b/lib/server/WinNamedPipeStream.cpp
index a3e7575e..37a29cc8 100644
--- a/lib/server/WinNamedPipeStream.cpp
+++ b/lib/server/WinNamedPipeStream.cpp
@@ -286,7 +286,8 @@ bool WinNamedPipeStream::WaitForOverlappedOperation(OVERLAPPED& Overlapped,
"result code: " << waitResult);
}
- // object is ready to read from
+ // Overlapped operation completed successfully. Return the number
+ // of bytes transferred.
if (GetOverlappedResult(mSocketHandle, &Overlapped,
&NumBytesTransferred, TRUE))
{
@@ -294,7 +295,8 @@ bool WinNamedPipeStream::WaitForOverlappedOperation(OVERLAPPED& Overlapped,
return true;
}
- // We are here because there was an error.
+ // We are here because GetOverlappedResult() informed us that the
+ // overlapped operation encountered an error, so what was it?
DWORD err = GetLastError();
if (err == ERROR_HANDLE_EOF)
@@ -356,8 +358,7 @@ int WinNamedPipeStream::Read(void *pBuffer, int NBytes, int Timeout)
int64_t NumBytesRead;
- // satisfy from buffer if possible, to avoid
- // blocking on read.
+ // Satisfy from buffer if possible, to avoid blocking on read.
bool needAnotherRead = false;
if (mBytesInBuffer == 0)
{
@@ -467,7 +468,10 @@ void WinNamedPipeStream::Write(const void *pBuffer, int NBytes, int Timeout)
if (Success == TRUE)
{
- BOX_NOTICE("Write claimed success while overlapped?");
+ // Unfortunately this does happen. We should still call
+ // GetOverlappedResult() to get the number of bytes written,
+ // so we can treat it just the same.
+ // BOX_NOTICE("Write claimed success while overlapped?");
mWritesInProgress.push_back(new_write);
}
else