Commit 8f2a14b1 authored by Philip Withnall's avatar Philip Withnall

socket: Handle ECONNRESET as EWOULDBLOCK on Windows

Summary:
Some versions of Windows can return ECONNRESET for UDP recvmsg() calls
if they would otherwise block. Hence, handle the two equivalently; this
should not affect behaviour on Linux, which apparently does not return
ECONNRESET for UDP recvmsg() calls at all.

https://phabricator.freedesktop.org/T121

Maniphest Tasks: T121

Reviewers: ocrete

Projects: #libnice

Reviewed By: ocrete

Subscribers: stwiname, felixSchl

Differential Revision: https://phabricator.freedesktop.org/D227
parents e5e77b67 ad0003b4
...@@ -204,7 +204,10 @@ socket_recv_messages (NiceSocket *sock, ...@@ -204,7 +204,10 @@ socket_recv_messages (NiceSocket *sock,
recv_message->length = MAX (recvd, 0); recv_message->length = MAX (recvd, 0);
if (recvd < 0) { if (recvd < 0) {
if (g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) /* Handle ECONNRESET here as if it were EWOULDBLOCK; see
* https://phabricator.freedesktop.org/T121 */
if (g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK) ||
g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_CONNECTION_CLOSED))
recvd = 0; recvd = 0;
else else
error = TRUE; error = TRUE;
......
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