Skip to content

Commit

Permalink
Merge pull request #1 from studio-link-3rdparty/recv_handler_win_patch
Browse files Browse the repository at this point in the history
tcp: close socket on windows if connection is aborted or reset
  • Loading branch information
sreimers authored Jul 11, 2020
2 parents ea0509d + aad58ee commit 324a6c3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/tcp/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,17 @@ static void tcp_recv_handler(int flags, void *arg)
return;
}
else if (n < 0) {
#ifdef WIN32
err = WSAGetLastError();
DEBUG_WARNING("recv handler: recv(): %d\n", err);
if (err == WSAECONNRESET || err == WSAECONNABORTED) {
mem_deref(mb);
conn_close(tc, err);
return;
}
#else
DEBUG_WARNING("recv handler: recv(): %m\n", errno);
#endif
goto out;
}

Expand Down

0 comments on commit 324a6c3

Please sign in to comment.