Loading changes/issue40597 0 → 100644 +4 −0 Original line number Diff line number Diff line o Minor features (relays): - Trigger OOS when bind fails with EADDRINUSE. This improves fairness when a large number of exit connections are requested, and properly signals exhaustion to the network. Fixes issue 40597; patch by Alex Xu (Hello71). src/core/mainloop/connection.c +15 −9 Original line number Diff line number Diff line Loading @@ -2224,21 +2224,27 @@ connection_connect_sockaddr,(connection_t *conn, tor_socket_strerror(errno)); } /* * We've got the socket open; give the OOS handler a chance to check * against configured maximum socket number, but tell it no exhaustion * failure. */ connection_check_oos(get_n_open_sockets(), 0); if (bindaddr && bind(s, bindaddr, bindaddr_len) < 0) { *socket_error = tor_socket_errno(s); if (ERRNO_IS_EADDRINUSE(*socket_error)) { socket_failed_from_resource_exhaustion(); connection_check_oos(get_n_open_sockets(), 1); } else { log_warn(LD_NET,"Error binding network socket: %s", tor_socket_strerror(*socket_error)); connection_check_oos(get_n_open_sockets(), 0); } tor_close_socket(s); return -1; } /* * We've got the socket open and bound; give the OOS handler a chance to * check against configured maximum socket number, but tell it no exhaustion * failure. */ connection_check_oos(get_n_open_sockets(), 0); tor_assert(options); if (options->ConstrainedSockets) set_constrained_socket_buffers(s, (int)options->ConstrainedSockSize); Loading Loading
changes/issue40597 0 → 100644 +4 −0 Original line number Diff line number Diff line o Minor features (relays): - Trigger OOS when bind fails with EADDRINUSE. This improves fairness when a large number of exit connections are requested, and properly signals exhaustion to the network. Fixes issue 40597; patch by Alex Xu (Hello71).
src/core/mainloop/connection.c +15 −9 Original line number Diff line number Diff line Loading @@ -2224,21 +2224,27 @@ connection_connect_sockaddr,(connection_t *conn, tor_socket_strerror(errno)); } /* * We've got the socket open; give the OOS handler a chance to check * against configured maximum socket number, but tell it no exhaustion * failure. */ connection_check_oos(get_n_open_sockets(), 0); if (bindaddr && bind(s, bindaddr, bindaddr_len) < 0) { *socket_error = tor_socket_errno(s); if (ERRNO_IS_EADDRINUSE(*socket_error)) { socket_failed_from_resource_exhaustion(); connection_check_oos(get_n_open_sockets(), 1); } else { log_warn(LD_NET,"Error binding network socket: %s", tor_socket_strerror(*socket_error)); connection_check_oos(get_n_open_sockets(), 0); } tor_close_socket(s); return -1; } /* * We've got the socket open and bound; give the OOS handler a chance to * check against configured maximum socket number, but tell it no exhaustion * failure. */ connection_check_oos(get_n_open_sockets(), 0); tor_assert(options); if (options->ConstrainedSockets) set_constrained_socket_buffers(s, (int)options->ConstrainedSockSize); Loading