- Fix to squelch tcp socket bind failures when the interface is gone.

This commit is contained in:
W.C.A. Wijngaards 2021-05-04 16:21:42 +02:00
parent 71f311dbe1
commit 90d0f8bc19
2 changed files with 9 additions and 1 deletions

View file

@ -5,6 +5,7 @@
4 May 2021: Wouter
- Merge #478: Allow configuration of TCP timeout while waiting for
response.
- Fix to squelch tcp socket bind failures when the interface is gone.
3 May 2021: Wouter
- Fix #481: Fix comment in configuration file.

View file

@ -238,6 +238,13 @@ pick_outgoing_tcp(struct pending_tcp* pend, struct waiting_tcp* w, int s)
((struct sockaddr_in6*)&pi->addr)->sin6_port = 0;
else ((struct sockaddr_in*)&pi->addr)->sin_port = 0;
if(bind(s, (struct sockaddr*)&pi->addr, pi->addrlen) != 0) {
#ifndef USE_WINSOCK
#ifdef EADDRNOTAVAIL
if(!(verbosity < 4 && errno == EADDRNOTAVAIL))
#endif
#else /* USE_WINSOCK */
if(!(verbosity < 4 && WSAGetLastError() == WSAEADDRNOTAVAIL))
#endif
log_err("outgoing tcp: bind: %s", sock_strerror(errno));
sock_close(s);
return 0;