summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2015-08-19 09:19:18 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2015-08-19 09:19:18 +0100
commit8f2a14b1d6af73e91c5712898e8a3e97308920a6 (patch)
tree8bfcb876bd34b8bb5e18a7fce31026801d1abca4
parente5e77b67fb6152dd9fb0af3d7410a428299504d3 (diff)
parentad0003b48414c789a1191fd5f44fec41e694dfa0 (diff)
downloadlibnice-8f2a14b1d6af73e91c5712898e8a3e97308920a6.tar.gz
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
-rw-r--r--socket/udp-bsd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/socket/udp-bsd.c b/socket/udp-bsd.c
index d56f093..d7346ff 100644
--- a/socket/udp-bsd.c
+++ b/socket/udp-bsd.c
@@ -204,7 +204,10 @@ socket_recv_messages (NiceSocket *sock,
recv_message->length = MAX (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;
else
error = TRUE;