X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/be2c97a53a1b69de5359c00a308730c0001ad758..ec8177c5c7b355a953871d6fded9ae77cf2a4a96:/src/ioset.c diff --git a/src/ioset.c b/src/ioset.c index ea71397..b6269ac 100644 --- a/src/ioset.c +++ b/src/ioset.c @@ -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) {