summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
Diffstat (limited to 'extra')
-rw-r--r--extra/yassl/src/handshake.cpp2
-rw-r--r--extra/yassl/src/socket_wrapper.cpp18
2 files changed, 17 insertions, 3 deletions
diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp
index fb342a10fd5..3a1ade9816c 100644
--- a/extra/yassl/src/handshake.cpp
+++ b/extra/yassl/src/handshake.cpp
@@ -529,7 +529,7 @@ void ProcessOldClientHello(input_buffer& input, SSL& ssl)
ato16(len, randomLen);
if (ch.suite_len_ > MAX_SUITE_SZ || sessionLen > ID_LEN ||
- randomLen > RAN_LEN) {
+ randomLen > RAN_LEN) {
ssl.SetError(bad_input);
return;
}
diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp
index cf761d912e6..4d41c4f8442 100644
--- a/extra/yassl/src/socket_wrapper.cpp
+++ b/extra/yassl/src/socket_wrapper.cpp
@@ -202,8 +202,22 @@ uint Socket::receive(byte* buf, unsigned int sz, int flags)
// wait if blocking for input, return false for error
bool Socket::wait()
{
- byte b;
- return receive(&b, 1, MSG_PEEK) != static_cast<uint>(-1);
+ char b;
+ int recvd = ::recv(socket_, &b, 1, MSG_PEEK);
+
+ if (recvd == -1) {
+ if (get_lastError() == SOCKET_EWOULDBLOCK ||
+ get_lastError() == SOCKET_EAGAIN) {
+ wouldBlock_ = true; // would have blocked this time only
+ nonBlocking_ = true; // socket nonblocking, win32 only way to tell
+ return 1;
+ }
+ }
+ else if (recvd == 0)
+ return 0; // Non blocking & no data
+
+ return 1; // Data can be read
+
}