mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
Handle WSAECONNRESET to avoid stopping the supernode on Windows
This commit is contained in:
parent
03dbedd52b
commit
03761fc84c
10
edge_utils.c
10
edge_utils.c
|
@ -1311,7 +1311,15 @@ static void readFromIPSocket(n2n_edge_t * eee, int in_sock) {
|
||||||
(struct sockaddr *)&sender_sock, (socklen_t*)&i);
|
(struct sockaddr *)&sender_sock, (socklen_t*)&i);
|
||||||
|
|
||||||
if(recvlen < 0) {
|
if(recvlen < 0) {
|
||||||
traceEvent(TRACE_ERROR, "recvfrom failed with %s", strerror(errno));
|
#ifdef WIN32
|
||||||
|
if(WSAGetLastError() != WSAECONNRESET)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", recvlen, errno, strerror(errno));
|
||||||
|
#ifdef WIN32
|
||||||
|
traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return; /* failed to receive data from UDP */
|
return; /* failed to receive data from UDP */
|
||||||
}
|
}
|
||||||
|
|
9
sn.c
9
sn.c
|
@ -968,10 +968,17 @@ static int run_loop(n2n_sn_t * sss) {
|
||||||
bread = recvfrom(sss->sock, pktbuf, N2N_SN_PKTBUF_SIZE, 0/*flags*/,
|
bread = recvfrom(sss->sock, pktbuf, N2N_SN_PKTBUF_SIZE, 0/*flags*/,
|
||||||
(struct sockaddr *)&sender_sock, (socklen_t*)&i);
|
(struct sockaddr *)&sender_sock, (socklen_t*)&i);
|
||||||
|
|
||||||
if(bread < 0) {
|
if((bread < 0)
|
||||||
|
#ifdef WIN32
|
||||||
|
&& (WSAGetLastError() != WSAECONNRESET)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
/* For UDP bread of zero just means no data (unlike TCP). */
|
/* For UDP bread of zero just means no data (unlike TCP). */
|
||||||
/* The fd is no good now. Maybe we lost our interface. */
|
/* The fd is no good now. Maybe we lost our interface. */
|
||||||
traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno));
|
traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno));
|
||||||
|
#ifdef WIN32
|
||||||
|
traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError());
|
||||||
|
#endif
|
||||||
keep_running=0;
|
keep_running=0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user