*
* 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,
}
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);
static void
ioset_buffered_read(struct io_fd *fd) {
- int put_avail, nbr, fdnum;
+ int put_avail, nbr;
if (!(put_avail = ioq_put_avail(&fd->recv)))
put_avail = ioq_grow(&fd->recv);
fd->recv.put += nbr;
if (fd->recv.put == fd->recv.size)
fd->recv.put = 0;
- fdnum = fd->fd;
while (fd->line_len > 0) {
struct io_fd *old_active;
int died = 0;
/* 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) {