Code

socket frontend: Try to reopen a connection if it has been closed.
authorSebastian Harl <sh@tokkee.org>
Sat, 26 Oct 2013 12:14:11 +0000 (14:14 +0200)
committerSebastian Harl <sh@tokkee.org>
Sat, 26 Oct 2013 12:14:11 +0000 (14:14 +0200)
src/frontend/sock.c

index d47240c35db359b1fda80d46e691b6d78273bbb4..ba9b3a867bb637262f711a2a29618002f7310529 100644 (file)
@@ -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",