Fixes for EMNET with non-blocking to handle want read/want write. ZD 18012

This commit is contained in:
David Garske
2024-05-17 12:51:12 -07:00
parent e05dbd531e
commit 9b058ec3a2
2 changed files with 9 additions and 2 deletions

View File

@@ -153,6 +153,11 @@ static WC_INLINE int TranslateReturnCode(int old, int sd)
if (errno == RTCSERR_TCP_TIMED_OUT) if (errno == RTCSERR_TCP_TIMED_OUT)
errno = SOCKET_EAGAIN; errno = SOCKET_EAGAIN;
} }
#elif defined(WOLFSSL_EMNET)
if (old < 0) { /* SOCKET_ERROR */
/* Get the real socket error */
IP_SOCK_getsockopt(sd, SOL_SOCKET, SO_ERROR, &old, (int)sizeof(old));
}
#endif #endif
return old; return old;
@@ -166,7 +171,7 @@ static WC_INLINE int wolfSSL_LastError(int err)
return WSAGetLastError(); return WSAGetLastError();
#elif defined(EBSNET) #elif defined(EBSNET)
return xn_getlasterror(); return xn_getlasterror();
#elif defined(WOLFSSL_LINUXKM) #elif defined(WOLFSSL_LINUXKM) || defined(WOLFSSL_EMNET)
return err; /* Return provided error value */ return err; /* Return provided error value */
#elif defined(FUSION_RTOS) #elif defined(FUSION_RTOS)
#include <fclerrno.h> #include <fclerrno.h>

View File

@@ -150,6 +150,8 @@
#include <sys/fcltypes.h> #include <sys/fcltypes.h>
#include <fclerrno.h> #include <fclerrno.h>
#include <fclfcntl.h> #include <fclfcntl.h>
#elif defined(WOLFSSL_EMNET)
#include <IP/IP.h>
#elif !defined(WOLFSSL_NO_SOCK) #elif !defined(WOLFSSL_NO_SOCK)
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
@@ -305,7 +307,7 @@
#define SOCKET_ECONNREFUSED ERR_CONN #define SOCKET_ECONNREFUSED ERR_CONN
#define SOCKET_ECONNABORTED ERR_ABRT #define SOCKET_ECONNABORTED ERR_ABRT
#elif defined(WOLFSSL_EMNET) #elif defined(WOLFSSL_EMNET)
#include <IP/IP.h> #define XSOCKLENT int
#define SOCKET_EWOULDBLOCK IP_ERR_WOULD_BLOCK #define SOCKET_EWOULDBLOCK IP_ERR_WOULD_BLOCK
#define SOCKET_EAGAIN IP_ERR_WOULD_BLOCK #define SOCKET_EAGAIN IP_ERR_WOULD_BLOCK
#define SOCKET_ECONNRESET IP_ERR_CONN_RESET #define SOCKET_ECONNRESET IP_ERR_CONN_RESET