diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2015-08-19 09:19:18 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2015-08-19 09:19:18 +0100 |
commit | 8f2a14b1d6af73e91c5712898e8a3e97308920a6 (patch) | |
tree | 8bfcb876bd34b8bb5e18a7fce31026801d1abca4 /socket | |
parent | e5e77b67fb6152dd9fb0af3d7410a428299504d3 (diff) | |
parent | ad0003b48414c789a1191fd5f44fec41e694dfa0 (diff) | |
download | libnice-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
Diffstat (limited to 'socket')
-rw-r--r-- | socket/udp-bsd.c | 5 |
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; |