Skip to content

Commit 9b058ec

Browse files
committed
Fixes for EMNET with non-blocking to handle want read/want write. ZD 18012
1 parent e05dbd5 commit 9b058ec

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/wolfio.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ static WC_INLINE int TranslateReturnCode(int old, int sd)
153153
if (errno == RTCSERR_TCP_TIMED_OUT)
154154
errno = SOCKET_EAGAIN;
155155
}
156+
#elif defined(WOLFSSL_EMNET)
157+
if (old < 0) { /* SOCKET_ERROR */
158+
/* Get the real socket error */
159+
IP_SOCK_getsockopt(sd, SOL_SOCKET, SO_ERROR, &old, (int)sizeof(old));
160+
}
156161
#endif
157162

158163
return old;
@@ -166,7 +171,7 @@ static WC_INLINE int wolfSSL_LastError(int err)
166171
return WSAGetLastError();
167172
#elif defined(EBSNET)
168173
return xn_getlasterror();
169-
#elif defined(WOLFSSL_LINUXKM)
174+
#elif defined(WOLFSSL_LINUXKM) || defined(WOLFSSL_EMNET)
170175
return err; /* Return provided error value */
171176
#elif defined(FUSION_RTOS)
172177
#include <fclerrno.h>

wolfssl/wolfio.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@
150150
#include <sys/fcltypes.h>
151151
#include <fclerrno.h>
152152
#include <fclfcntl.h>
153+
#elif defined(WOLFSSL_EMNET)
154+
#include <IP/IP.h>
153155
#elif !defined(WOLFSSL_NO_SOCK)
154156
#include <sys/types.h>
155157
#include <errno.h>
@@ -305,7 +307,7 @@
305307
#define SOCKET_ECONNREFUSED ERR_CONN
306308
#define SOCKET_ECONNABORTED ERR_ABRT
307309
#elif defined(WOLFSSL_EMNET)
308-
#include <IP/IP.h>
310+
#define XSOCKLENT int
309311
#define SOCKET_EWOULDBLOCK IP_ERR_WOULD_BLOCK
310312
#define SOCKET_EAGAIN IP_ERR_WOULD_BLOCK
311313
#define SOCKET_ECONNRESET IP_ERR_CONN_RESET

0 commit comments

Comments
 (0)