diff options
Diffstat (limited to 'src/wsocket.c')
| -rw-r--r-- | src/wsocket.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wsocket.c b/src/wsocket.c index 86c6994..b2b668c 100644 --- a/src/wsocket.c +++ b/src/wsocket.c | |||
| @@ -286,6 +286,14 @@ int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, | |||
| 286 | } | 286 | } |
| 287 | if (taken == 0) return IO_CLOSED; | 287 | if (taken == 0) return IO_CLOSED; |
| 288 | err = WSAGetLastError(); | 288 | err = WSAGetLastError(); |
| 289 | /* a zero-length request is trivially "too small" for any | ||
| 290 | * non-empty datagram; unlike POSIX, which truncates and succeeds | ||
| 291 | * silently, Windows reports this as WSAEMSGSIZE even though the | ||
| 292 | * datagram -- and its sender's address, already written to addr/ | ||
| 293 | * len above -- was still consumed. Normalize it to match POSIX's | ||
| 294 | * silent-truncation instead of surfacing a platform-specific | ||
| 295 | * error for what is otherwise a successful, if empty, receive. */ | ||
| 296 | if (count == 0 && err == WSAEMSGSIZE) return IO_DONE; | ||
| 289 | /* On UDP, a connreset simply means the previous send failed. | 297 | /* On UDP, a connreset simply means the previous send failed. |
| 290 | * So we try again. | 298 | * So we try again. |
| 291 | * On TCP, it means our socket is now useless, so the error passes. | 299 | * On TCP, it means our socket is now useless, so the error passes. |
