Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Segger emNet to handle non-blocking want read/want write #7581

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/wolfio.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ static WC_INLINE int TranslateReturnCode(int old, int sd)
if (errno == RTCSERR_TCP_TIMED_OUT)
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

return old;
Expand All @@ -166,7 +171,7 @@ static WC_INLINE int wolfSSL_LastError(int err)
return WSAGetLastError();
#elif defined(EBSNET)
return xn_getlasterror();
#elif defined(WOLFSSL_LINUXKM)
#elif defined(WOLFSSL_LINUXKM) || defined(WOLFSSL_EMNET)
return err; /* Return provided error value */
#elif defined(FUSION_RTOS)
#include <fclerrno.h>
Expand Down
4 changes: 3 additions & 1 deletion wolfssl/wolfio.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
#include <sys/fcltypes.h>
#include <fclerrno.h>
#include <fclfcntl.h>
#elif defined(WOLFSSL_EMNET)
#include <IP/IP.h>
#elif !defined(WOLFSSL_NO_SOCK)
#include <sys/types.h>
#include <errno.h>
Expand Down Expand Up @@ -305,7 +307,7 @@
#define SOCKET_ECONNREFUSED ERR_CONN
#define SOCKET_ECONNABORTED ERR_ABRT
#elif defined(WOLFSSL_EMNET)
#include <IP/IP.h>
#define XSOCKLENT int
#define SOCKET_EWOULDBLOCK IP_ERR_WOULD_BLOCK
#define SOCKET_EAGAIN IP_ERR_WOULD_BLOCK
#define SOCKET_ECONNRESET IP_ERR_CONN_RESET
Expand Down