]> git.pond.sub.org Git - empserver/commitdiff
(player_init) [_WIN32,__linux__ && __alpha__]: Remove the
authorRon Koenderink <rkoenderink@yahoo.ca>
Sat, 23 Jul 2005 13:43:35 +0000 (13:43 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Sat, 23 Jul 2005 13:43:35 +0000 (13:43 +0000)
SO_REUSEADDR socket option as it is not required for WIN32.
In WIN32, there is no waiting time when a port is closed before
it can be reused so SO_REUSEADDR is not required for WIN32.
Leave the option has a undesirable effect of allowing a second
server instance to start without an error and leaving both
instances running.  ALPHA and LINUX do support SO_REUSEADDR.

src/lib/player/accept.c

index 55b354be67bd7241d14e3587c599481c11a503e1..faeda1c222408ec3e2c1c1c419fbe70838ac1cbb 100644 (file)
@@ -92,13 +92,18 @@ player_init(void)
        exit(1);
     }
     val = 1;
-#if !(defined(__linux__) && defined(__alpha__))
+    /*
+     * WIN32's SO_REUSEADDR operates differently than POSIX's SO_REUSEADDR.
+     * WIN32's SO_REUSEADDR allows the port number to be used immediately
+     * even if the port number is currently being used by another program.
+     * In WIN32, there is no waiting time when a port is closed before it
+     * can be reused so SO_REUSEADDR is not required for WIN32.
+     */
+#ifndef _WIN32
     if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
        logerror("inet socket setsockopt SO_REUSEADDR (%d)", errno);
        exit(1);
     }
-#else
-    logerror("Alpha/Linux?  You don't support SO_REUSEADDR yet, do you?\n");
 #endif
     if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
        logerror("inet socket bind");