fix(wsocket): Properly report CONNRESET (#81)

This commit is contained in:
Paul Kulchenko 2023-11-09 03:00:09 -08:00 committed by GitHub
parent bef62aeb50
commit 22b8202d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,6 +262,7 @@ int socket_recv(p_socket ps, char *data, size_t count, size_t *got,
if (err != WSAEWOULDBLOCK) { if (err != WSAEWOULDBLOCK) {
if (err != WSAECONNRESET || prev == WSAECONNRESET) return err; if (err != WSAECONNRESET || prev == WSAECONNRESET) return err;
prev = err; prev = err;
continue;
} }
if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err;
} }
@ -291,6 +292,7 @@ int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got,
if (err != WSAEWOULDBLOCK) { if (err != WSAEWOULDBLOCK) {
if (err != WSAECONNRESET || prev == WSAECONNRESET) return err; if (err != WSAECONNRESET || prev == WSAECONNRESET) return err;
prev = err; prev = err;
continue;
} }
if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err;
} }