diff options
author | Roger Dingledine <arma@torproject.org> | 2012-01-23 15:54:02 -0500 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2012-01-23 15:54:02 -0500 |
commit | 247a21379af1cf90896d9818cf448d9687f6277c (patch) | |
tree | 4a20cbe265a8166b6c7b087d5c1270bb987ab761 /src/or | |
parent | efb60e21320b927213c59c4e66bbc660c1973866 (diff) | |
download | tor-247a21379af1cf90896d9818cf448d9687f6277c.tar tor-247a21379af1cf90896d9818cf448d9687f6277c.tar.gz |
set SO_REUSEADDR before we bind, not after
resolves bug 4950 (fixes a bug on commit aba7bb705a6 from #2850)
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/connection.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 462022dff..c51e7fbef 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1338,6 +1338,8 @@ connection_connect(connection_t *conn, const char *address, return -1; } + make_socket_reuseable(s); + if (options->OutboundBindAddress && !tor_addr_is_loopback(addr)) { struct sockaddr_in ext_addr; @@ -1372,8 +1374,6 @@ connection_connect(connection_t *conn, const char *address, log_debug(LD_NET, "Connecting to %s:%u.", escaped_safe_str_client(address), port); - make_socket_reuseable(s); - if (connect(s, dest_addr, (socklen_t)dest_addr_len) < 0) { int e = tor_socket_errno(s); if (!ERRNO_IS_CONN_EINPROGRESS(e)) { |