diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-08-04 23:42:27 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-08-05 08:16:31 -0400 |
commit | 3ebcd323bdeeb55bb963fe5e9d97a87f96fd8879 (patch) | |
tree | fa14531616d71cbd574b5914bcf79a38eb849596 /src/core/service.c | |
parent | 9dfb64f87da718284f5c840ac6176dccbfd7dc3e (diff) |
systemd: do not serialize peer, bump count when deserializing socket instead
Diffstat (limited to 'src/core/service.c')
-rw-r--r-- | src/core/service.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/service.c b/src/core/service.c index 1629e1ce44..3c9455a5f8 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1041,6 +1041,20 @@ static int service_coldplug(Unit *u) { if (!IN_SET(s->deserialized_state, SERVICE_DEAD, SERVICE_FAILED, SERVICE_AUTO_RESTART)) (void) unit_setup_dynamic_creds(u); + if (UNIT_ISSET(s->accept_socket)) { + Socket* socket = SOCKET(UNIT_DEREF(s->accept_socket)); + + if (socket->max_connections_per_source > 0) { + SocketPeer *peer; + + /* Make a best-effort attempt at bumping the connection count */ + if (socket_acquire_peer(socket, s->socket_fd, &peer) > 0) { + socket_peer_unref(s->peer); + s->peer = peer; + } + } + } + service_set_state(s, s->deserialized_state); return 0; } |