From: Sebastian Harl Date: Sat, 26 Oct 2013 12:14:11 +0000 (+0200) Subject: socket frontend: Try to reopen a connection if it has been closed. X-Git-Tag: sysdb-0.1.0~336^2~27 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=e2d1b74f38a19ef0a55c7f225dc72ebeaa88c157 socket frontend: Try to reopen a connection if it has been closed. --- diff --git a/src/frontend/sock.c b/src/frontend/sock.c index d47240c..ba9b3a8 100644 --- a/src/frontend/sock.c +++ b/src/frontend/sock.c @@ -238,6 +238,12 @@ listener_listen(listener_t *listener) { assert(listener); + /* try to reopen */ + if (listener->sock_fd < 0) + if (listener_impls[listener->type].opener(listener)) + return -1; + assert(listener->sock_fd >= 0); + if (listen(listener->sock_fd, /* backlog = */ 32)) { char buf[1024]; sdb_log(SDB_LOG_ERR, "frontend: Failed to listen on socket %s: %s",