summaryrefslogtreecommitdiff
path: root/lib/server/SocketStreamTLS.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-09-04 01:36:08 +0000
committerChris Wilson <chris+github@qwirx.com>2014-09-04 01:36:08 +0000
commit426a506afd1ffb3bd67e61b4693ee9bb968097a1 (patch)
treea6a726552411a781e692de657e3a630fa8d65d65 /lib/server/SocketStreamTLS.cpp
parent75ad60bcc4d33589bb5afb307a87fd19b220a9e8 (diff)
Simplify code with macros, update comments and fix whitespace.
Hopefully all of these changes are inconsequential. Merged back changes from the test refactor branch to reduce diffs.
Diffstat (limited to 'lib/server/SocketStreamTLS.cpp')
-rw-r--r--lib/server/SocketStreamTLS.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/server/SocketStreamTLS.cpp b/lib/server/SocketStreamTLS.cpp
index e31ac13f..953012d1 100644
--- a/lib/server/SocketStreamTLS.cpp
+++ b/lib/server/SocketStreamTLS.cpp
@@ -132,7 +132,7 @@ void SocketStreamTLS::Handshake(const TLSContext &rContext, bool IsServer)
tOSSocketHandle socket = GetSocketHandle();
BIO_set_fd(mpBIO, socket, BIO_NOCLOSE);
-
+
// Then the SSL object
mpSSL = ::SSL_new(rContext.GetRawContext());
if(mpSSL == 0)
@@ -155,7 +155,7 @@ void SocketStreamTLS::Handshake(const TLSContext &rContext, bool IsServer)
THROW_EXCEPTION(ServerException, SocketSetNonBlockingFailed)
}
#endif
-
+
// FIXME: This is less portable than the above. However, it MAY be needed
// for cygwin, which has/had bugs with fcntl
//
@@ -223,8 +223,9 @@ void SocketStreamTLS::Handshake(const TLSContext &rContext, bool IsServer)
//
// Function
// Name: WaitWhenRetryRequired(int, int)
-// Purpose: Waits until the condition required by the TLS layer is met.
-// Returns true if the condition is met, false if timed out.
+// Purpose: Waits until the condition required by the TLS layer
+// is met. Returns true if the condition is met, false
+// if timed out.
// Created: 2003/08/15
//
// --------------------------------------------------------------------------
@@ -320,20 +321,20 @@ int SocketStreamTLS::Read(void *pBuffer, int NBytes, int Timeout)
void SocketStreamTLS::Write(const void *pBuffer, int NBytes, int Timeout)
{
if(!mpSSL) {THROW_EXCEPTION(ServerException, TLSNoSSLObject)}
-
+
// Make sure zero byte writes work as expected
if(NBytes == 0)
{
return;
}
-
+
// from man SSL_write
//
// SSL_write() will only return with success, when the
// complete contents of buf of length num has been written.
//
// So no worries about partial writes and moving the buffer around
-
+
while(true)
{
// try the write