Commit 834dcb91 authored by Youness Alaoui's avatar Youness Alaoui

Even for UDP sockets, we should handle EAGAIN errors because it can happen.....

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
parent be58253f
......@@ -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);
......
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