chiark / gitweb /
systemadm; fix alignment of labels
[elogind.git] / socket.c
index 3e7b0f8ba5f94b0e0e7c7029e163c59d77c7f84c..755bc598da7e035b3a278525b543e717ff4caec4 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -119,9 +119,14 @@ static bool have_non_accept_socket(Socket *s) {
         if (!s->accept)
                 return true;
 
-        LIST_FOREACH(port, p, s->ports)
+        LIST_FOREACH(port, p, s->ports) {
+
+                if (p->type != SOCKET_SOCKET)
+                        return true;
+
                 if (!socket_address_can_accept(&p->address))
                         return true;
+        }
 
         return false;
 }
@@ -251,7 +256,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
                 if (!s->exec_command[c])
                         continue;
 
-                fprintf(f, "%s %s:\n",
+                fprintf(f, "%s-> %s:\n",
                         prefix, socket_exec_command_to_string(c));
 
                 exec_command_dump_list(s->exec_command[c], f, prefix2);
@@ -448,8 +453,9 @@ static int socket_watch_fds(Socket *s) {
                 if (p->fd < 0)
                         continue;
 
-                p->fd_watch.data.socket_accept =
+                p->fd_watch.socket_accept =
                         s->accept &&
+                        p->type == SOCKET_SOCKET &&
                         socket_address_can_accept(&p->address);
 
                 if ((r = unit_watch_fd(UNIT(s), p->fd, EPOLLIN, &p->fd_watch)) < 0)
@@ -496,7 +502,7 @@ static void socket_set_state(Socket *s, SocketState state) {
                 socket_close_fds(s);
 
         if (state != old_state)
-                log_debug("%s changed %s  %s",
+                log_debug("%s changed %s -> %s",
                           s->meta.id,
                           socket_state_to_string(old_state),
                           socket_state_to_string(state));
@@ -661,7 +667,7 @@ static void socket_enter_signal(Socket *s, SocketState state, bool success) {
                         }
         }
 
-        if (sent) {
+        if (sent && s->control_pid > 0) {
                 if ((r = unit_watch_timer(UNIT(s), s->timeout_usec, &s->timer_watch)) < 0)
                         goto fail;
 
@@ -1088,7 +1094,7 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
                 goto fail;
         }
 
-        if (w->data.socket_accept) {
+        if (w->socket_accept) {
                 for (;;) {
 
                         if ((cfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK)) < 0) {
@@ -1104,7 +1110,6 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
                 }
         }
 
-        log_debug("cfd=%i", cfd);
         socket_enter_running(s, cfd);
         return;