diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2009-11-10 14:27:03 -0500 |
---|---|---|
committer | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2009-11-10 14:27:03 -0500 |
commit | 834dcb91f4b7020b367e8359e05ea546ac7bae0e (patch) | |
tree | 34f47fedb292ebb6578dd2d8b3a191e3fb916573 /socket/udp-bsd.c | |
parent | be58253f0de3b89872105395b37a2e474645c6e8 (diff) | |
download | libnice-834dcb91f4b7020b367e8359e05ea546ac7bae0e.tar.gz |
Even for UDP sockets, we should handle EAGAIN errors because it can happen.. Apparently recvfrom can return EAGAIN on udp sockets if for example there's a bad checksum in the packet or some other similar error
Diffstat (limited to 'socket/udp-bsd.c')
-rw-r--r-- | socket/udp-bsd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/socket/udp-bsd.c b/socket/udp-bsd.c index db302eb..f2fcb4d 100644 --- a/socket/udp-bsd.c +++ b/socket/udp-bsd.c @@ -160,6 +160,15 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) recvd = recvfrom (sock->fileno, buf, len, 0, (struct sockaddr *) &sa, &from_len); + if (recvd < 0) { +#ifdef G_OS_WIN32 + if (WSAGetLastError () == WSAEWOULDBLOCK) +#else + if (errno == EAGAIN || errno == EWOULDBLOCK) +#endif + return 0; + } + if (recvd > 0) nice_address_set_from_sockaddr (from, (struct sockaddr *)&sa); |