Commit c03ac48b authored by Madaro Livio's avatar Madaro Livio Committed by Youness Alaoui

udp-bsd: Do not return an error for CONNRESET errors from ICMP

I have a use case where len < 0 but the socket is still working.
It is when the stun server is not listening and the client receives
ICMP messages. I think it is a Windows specific problem.
Calling WSAGetLastError() returns WSAECONNRESET.
The MSDN documentation sais:
"On a UDP-datagram socket, this error would indicate that a previous
send operation resulted in an ICMP "Port Unreachable" message."
http://msdn.microsoft.com/en-us/library/windows/desktop/ms740121(v=vs.85).aspx
parent 0828f92e
......@@ -161,7 +161,8 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
if (recvd < 0) {
#ifdef G_OS_WIN32
if (WSAGetLastError () == WSAEWOULDBLOCK)
if (WSAGetLastError () == WSAEWOULDBLOCK ||
WSAGetLastError () == WSAECONNRESET)
#else
if (errno == EAGAIN || errno == EWOULDBLOCK)
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment