summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-10-05 19:49:15 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-05 19:50:00 +0200
commitf976f3f67ce5140dc0ba48e0c21a91a553905c57 (patch)
treedbb2171d6d6d8b03ef58b2a8f53f0ba59c819a3e /src/socket.c
parentd9ff321ad9477664c34b81a9dd4fce616e44124e (diff)
socket: make sockets to pass to a service configurable
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/socket.c b/src/socket.c
index bbb54f6308..2567d0febf 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -129,8 +129,10 @@ static void socket_done(Unit *u) {
LIST_FOREACH(units_per_type, i, u->meta.manager->units_per_type[UNIT_SERVICE]) {
Service *service = (Service *) i;
- if (service->socket == s)
- service->socket = NULL;
+ if (service->accept_socket == s)
+ service->accept_socket = NULL;
+
+ set_remove(service->configured_sockets, s);
}
}
@@ -1197,8 +1199,27 @@ static void socket_enter_running(Socket *s, int cfd) {
}
if (cfd < 0) {
- if ((r = manager_add_job(s->meta.manager, JOB_START, UNIT(s->service), JOB_REPLACE, true, &error, NULL)) < 0)
- goto fail;
+ bool pending = false;
+ Meta *i;
+
+ /* If there's already a start pending don't bother to
+ * do anything */
+ LIST_FOREACH(units_per_type, i, s->meta.manager->units_per_type[UNIT_SERVICE]) {
+ Service *service = (Service *) i;
+
+ if (!set_get(service->configured_sockets, s))
+ continue;
+
+ if (!unit_pending_active(UNIT(service)))
+ continue;
+
+ pending = true;
+ break;
+ }
+
+ if (!pending)
+ if ((r = manager_add_job(s->meta.manager, JOB_START, UNIT(s->service), JOB_REPLACE, true, &error, NULL)) < 0)
+ goto fail;
socket_set_state(s, SOCKET_RUNNING);
} else {