summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-03-24 23:20:06 +0000
committerRoger Dingledine <arma@torproject.org>2005-03-24 23:20:06 +0000
commitbd37c9a3bd76085d5ac7daff2934e9705c20ac89 (patch)
tree74e7069bfce13f2f607c2e389166e6ae2c78dd92 /src
parent4abb54a876e2da7f0706975237908df553eb75a6 (diff)
downloadtor-bd37c9a3bd76085d5ac7daff2934e9705c20ac89.tar.gz
tor-bd37c9a3bd76085d5ac7daff2934e9705c20ac89.zip
REUSEADDR on normal places means you can rebind to the port
right after somebody else has let it go. But REUSEADDR on win32 means to let you bind to the port _even when somebody else already has it bound_. So, don't do that on Win32. svn:r3867
Diffstat (limited to 'src')
-rw-r--r--src/or/connection.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 81e42236c1..acf3465a2e 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -401,7 +401,9 @@ static int connection_create_listener(const char *bindaddress, uint16_t bindport
uint16_t usePort;
uint32_t addr;
int s; /* the socket we're going to make */
+#ifndef MS_WINDOWS
int one=1;
+#endif
memset(&bindaddr,0,sizeof(struct sockaddr_in));
if (parse_addr_port(bindaddress, NULL, &addr, &usePort)<0) {
@@ -425,7 +427,13 @@ static int connection_create_listener(const char *bindaddress, uint16_t bindport
return -1;
}
+#ifndef MS_WINDOWS
+ /* REUSEADDR on normal places means you can rebind to the port
+ * right after somebody else has let it go. But REUSEADDR on win32
+ * means to let you bind to the port _even when somebody else
+ * already has it bound_. So, don't do that on Win32. */
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void*) &one, sizeof(one));
+#endif
if (bind(s,(struct sockaddr *)&bindaddr,sizeof(bindaddr)) < 0) {
log_fn(LOG_WARN,"Could not bind to port %u: %s",usePort,