summaryrefslogtreecommitdiff
path: root/lib/server/SocketStreamTLS.cpp
diff options
context:
space:
mode:
authorMartin Ebourne <martin@ebourne.me.uk>2005-11-30 23:14:40 +0000
committerMartin Ebourne <martin@ebourne.me.uk>2005-11-30 23:14:40 +0000
commit01ca97865fa9d6ed1a967e970927265f1c348289 (patch)
tree5e7e1f70b38b156994c3802ba3e77fbf288fe937 /lib/server/SocketStreamTLS.cpp
parent99f8ce096bc5569adbfea1911dbcda24c28d8d8b (diff)
Merged martin/solaris at r9 to trunk
Diffstat (limited to 'lib/server/SocketStreamTLS.cpp')
-rwxr-xr-xlib/server/SocketStreamTLS.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/server/SocketStreamTLS.cpp b/lib/server/SocketStreamTLS.cpp
index 63ac7bb5..7d82f82c 100755
--- a/lib/server/SocketStreamTLS.cpp
+++ b/lib/server/SocketStreamTLS.cpp
@@ -14,7 +14,7 @@
#include <openssl/bio.h>
#include <poll.h>
#include <errno.h>
-#include <sys/ioctl.h>
+#include <fcntl.h>
#include "SocketStreamTLS.h"
#include "SSLLib.h"
@@ -132,12 +132,23 @@ void SocketStreamTLS::Handshake(const TLSContext &rContext, bool IsServer)
}
// Make the socket non-blocking so timeouts on Read work
- int nonblocking = true;
- if(::ioctl(socket, FIONBIO, &nonblocking) == -1)
+ // This is more portable than using ioctl with FIONBIO
+ int statusFlags = 0;
+ if(::fcntl(socket, F_GETFL, &statusFlags) < 0
+ || ::fcntl(socket, F_SETFL, statusFlags | O_NONBLOCK) == -1)
{
THROW_EXCEPTION(ServerException, SocketSetNonBlockingFailed)
}
+ // FIXME: This is less portable than the above. However, it MAY be needed
+ // for cygwin, which has/had bugs with fcntl
+ //
+ // int nonblocking = true;
+ // if(::ioctl(socket, FIONBIO, &nonblocking) == -1)
+ // {
+ // THROW_EXCEPTION(ServerException, SocketSetNonBlockingFailed)
+ // }
+
// Set the two to know about each other
::SSL_set_bio(mpSSL, mpBIO, mpBIO);