diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-12-22 19:30:07 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-12-22 22:17:58 +0100 |
commit | 01e10de3c2b9c2944bd86b12fab83d1164d0b64a (patch) | |
tree | 5d3a8f55246b255879b2fe199c5321508ba45f83 /src/core/socket.c | |
parent | 842f3b0fc983d9161e152da5b765008e3e6942a8 (diff) |
socket: support socket activation of containers
Diffstat (limited to 'src/core/socket.c')
-rw-r--r-- | src/core/socket.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index 18b81761c5..324ec1e34b 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1876,6 +1876,34 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value, return 0; } +static int socket_distribute_fds(Unit *u, FDSet *fds) { + Socket *s = SOCKET(u); + SocketPort *p; + + assert(u); + + LIST_FOREACH(port, p, s->ports) { + Iterator i; + int fd; + + if (p->type != SOCKET_SOCKET) + continue; + + if (p->fd >= 0) + continue; + + FDSET_FOREACH(fd, fds, i) { + if (socket_address_matches_fd(&p->address, fd)) { + p->fd = fdset_remove(fds, fd); + s->deserialized_state = SOCKET_LISTENING; + break; + } + } + } + + return 0; +} + static UnitActiveState socket_active_state(Unit *u) { assert(u); @@ -2288,6 +2316,7 @@ const UnitVTable socket_vtable = { .serialize = socket_serialize, .deserialize_item = socket_deserialize_item, + .distribute_fds = socket_distribute_fds, .active_state = socket_active_state, .sub_state_to_string = socket_sub_state_to_string, |