summaryrefslogtreecommitdiff
path: root/lib
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
parent7b7456c31276011f012ae7d9f02437ae31071c8c (diff)
Whitespace and comment fixes.
Improve correctness and reduce code duplication in bbackupctl.
Diffstat (limited to 'lib')
-rw-r--r--lib/server/WinNamedPipeListener.h4
-rw-r--r--lib/server/WinNamedPipeStream.cpp14
2 files changed, 11 insertions, 7 deletions
diff --git a/lib/server/WinNamedPipeListener.h b/lib/server/WinNamedPipeListener.h
index fab11a87..956a7b5a 100644
--- a/lib/server/WinNamedPipeListener.h
+++ b/lib/server/WinNamedPipeListener.h
@@ -53,8 +53,8 @@ private:
socket.c_str(), // pipe name
PIPE_ACCESS_DUPLEX | // read/write access
FILE_FLAG_OVERLAPPED, // enabled overlapped I/O
- PIPE_TYPE_BYTE | // message type pipe
- PIPE_READMODE_BYTE | // message-read mode
+ PIPE_TYPE_BYTE |
+ PIPE_READMODE_BYTE |
PIPE_WAIT, // blocking mode
ListenBacklog + 1, // max. instances
4096, // output buffer size
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