From ec3d0606919b3255027687014ae19a105b482c65 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 8 Mar 2013 18:09:52 -0800 Subject: [PATCH] fixed a cygwin bug for the build test. recv() was returning an unexpected error code for non-blocking sockets. --- src/io.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/io.c b/src/io.c index e6ceaa19e..6edb8008d 100644 --- a/src/io.c +++ b/src/io.c @@ -96,6 +96,7 @@ #define SOCKET_EINTR WSAEINTR #define SOCKET_EPIPE WSAEPIPE #define SOCKET_ECONNREFUSED WSAENOTCONN + #define SOCKET_ECONNABORTED WSAECONNABORTED #elif defined(__PPU) #define SOCKET_EWOULDBLOCK SYS_NET_EWOULDBLOCK #define SOCKET_EAGAIN SYS_NET_EAGAIN @@ -103,6 +104,7 @@ #define SOCKET_EINTR SYS_NET_EINTR #define SOCKET_EPIPE SYS_NET_EPIPE #define SOCKET_ECONNREFUSED SYS_NET_ECONNREFUSED + #define SOCKET_ECONNABORTED SYS_NET_ECONNABORTED #elif defined(FREESCALE_MQX) /* RTCS doesn't have an EWOULDBLOCK error */ #define SOCKET_EWOULDBLOCK EAGAIN @@ -111,6 +113,7 @@ #define SOCKET_EINTR EINTR #define SOCKET_EPIPE EPIPE #define SOCKET_ECONNREFUSED RTCSERR_TCP_CONN_REFUSED + #define SOCKET_ECONNABORTED RTCSERR_TCP_CONN_ABORTED #else #define SOCKET_EWOULDBLOCK EWOULDBLOCK #define SOCKET_EAGAIN EAGAIN @@ -118,6 +121,7 @@ #define SOCKET_EINTR EINTR #define SOCKET_EPIPE EPIPE #define SOCKET_ECONNREFUSED ECONNREFUSED + #define SOCKET_ECONNABORTED ECONNABORTED #endif /* USE_WINDOWS_API */ @@ -228,6 +232,10 @@ int EmbedReceive(CYASSL *ssl, char *buf, int sz, void *ctx) CYASSL_MSG(" Connection refused"); return IO_ERR_WANT_READ; } + else if (err == SOCKET_ECONNABORTED) { + CYASSL_MSG(" Connection aborted"); + return IO_ERR_CONN_CLOSE; + } else { CYASSL_MSG(" General error"); return IO_ERR_GENERAL;