summaryrefslogtreecommitdiff
path: root/socket/udp-bsd.c
diff options
context:
space:
mode:
authorMadaro Livio <livio.madaro@telecomitalia.it>2012-02-13 15:03:00 -0500
committerYouness Alaoui <youness.alaoui@collabora.co.uk>2012-02-13 15:03:00 -0500
commitc03ac48b9a1c27d20ee7a393c0e16a77801be2df (patch)
tree77ee111b72e90cfa72da5c4dba5e70e9a7b49ee6 /socket/udp-bsd.c
parent0828f92e42e2279b511e218440358907f1e06090 (diff)
downloadlibnice-c03ac48b9a1c27d20ee7a393c0e16a77801be2df.tar.gz
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
Diffstat (limited to 'socket/udp-bsd.c')
-rw-r--r--socket/udp-bsd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/socket/udp-bsd.c b/socket/udp-bsd.c
index 029d385..e61d4c0 100644
--- a/socket/udp-bsd.c
+++ b/socket/udp-bsd.c
@@ -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