]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/ioset.c
Minor typo in previous commit where returning 0 when it should have been 1 from opser...
[irc/evilnet/x3.git] / src / ioset.c
index 8e05488eb762474a0add2edca57d14bd024427b2..b6269ac2755516b6493f8c89abf46a12faa37935 100644 (file)
@@ -5,7 +5,7 @@
  *
  * srvx is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -220,18 +220,17 @@ struct io_fd *ioset_listen(struct sockaddr *local, unsigned int sa_size, void *d
     }
 
     if (local && sa_size) {
+        opt = 1;
+        res = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt, sizeof(opt));
+        if (res < 0) {
+            log_module(MAIN_LOG, LOG_WARNING, "Unable to mark listener address as re-usable: %s", strerror(errno));
+        }
         res = bind(fd, local, sa_size);
         if (res < 0) {
             log_module(MAIN_LOG, LOG_ERROR, "Unable to bind listening socket %d: %s", fd, strerror(errno));
             close(fd);
             return NULL;
         }
-
-        opt = 1;
-        res = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt, sizeof(opt));
-        if (res < 0) {
-            log_module(MAIN_LOG, LOG_WARNING, "Unable to mark listener address as re-usable: %s", strerror(errno));
-        }
     }
 
     res = listen(fd, 1);
@@ -598,7 +597,7 @@ ioset_run(void) {
         /* Call any timeq events we need to call. */
         timeq_run();
         if (do_write_dbs) {
-            saxdb_write_all();
+            saxdb_write_all(NULL);
             do_write_dbs = 0;
         }
         if (do_reopen) {