Improve and of ICMP messages on Windows.
When an ICMP message is received on Windows 10 for a UDP socket,
WSAECONNRESET is reported as an error. In this case, just read
again.
Thanks to nxrighthere for reporting the issue and helping to
nail it down.
This fixes #309.
diff --git a/usrsctplib/user_recv_thread.c b/usrsctplib/user_recv_thread.c
index 3428806..4d73a31 100755
--- a/usrsctplib/user_recv_thread.c
+++ b/usrsctplib/user_recv_thread.c
@@ -323,12 +323,10 @@
nResult = WSARecvFrom(SCTP_BASE_VAR(userspace_rawsctp), recv_iovec, MAXLEN_MBUF_CHAIN, &ncounter, &flags, (struct sockaddr *)&from, &fromlen, NULL, NULL);
if (nResult != 0) {
m_ErrorCode = WSAGetLastError();
- if (m_ErrorCode == WSAETIMEDOUT) {
- continue;
- }
if ((m_ErrorCode == WSAENOTSOCK) || (m_ErrorCode == WSAEINTR)) {
break;
}
+ continue;
}
n = ncounter;
#else
@@ -516,10 +514,10 @@
}
if (nResult != 0) {
m_ErrorCode = WSAGetLastError();
- if (m_ErrorCode == WSAETIMEDOUT)
- continue;
- if (m_ErrorCode == WSAENOTSOCK || m_ErrorCode == WSAEINTR)
+ if ((m_ErrorCode == WSAENOTSOCK) || (m_ErrorCode == WSAEINTR)) {
break;
+ }
+ continue;
}
n = ncounter;
#else
@@ -728,12 +726,10 @@
}
if (nResult != 0) {
m_ErrorCode = WSAGetLastError();
- if (m_ErrorCode == WSAETIMEDOUT) {
- continue;
- }
if ((m_ErrorCode == WSAENOTSOCK) || (m_ErrorCode == WSAEINTR)) {
break;
}
+ continue;
}
n = ncounter;
#endif
@@ -935,12 +931,10 @@
}
if (nResult != 0) {
m_ErrorCode = WSAGetLastError();
- if (m_ErrorCode == WSAETIMEDOUT) {
- continue;
- }
if ((m_ErrorCode == WSAENOTSOCK) || (m_ErrorCode == WSAEINTR)) {
break;
}
+ continue;
}
n = ncounter;
#endif