]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
nts: scale server listening backlog with number of helpers
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 27 Jul 2020 10:57:44 +0000 (12:57 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 28 Jul 2020 10:48:23 +0000 (12:48 +0200)
nts_ke_server.c

index 67500f410e07c5245fce974edb39d0db4ac2e085..41c0606d921968acd5ea3e11567392b786b7b1a0 100644 (file)
@@ -277,8 +277,8 @@ static int
 open_socket(int family)
 {
   IPSockAddr local_addr;
+  int backlog, sock_fd;
   char *iface;
-  int sock_fd;
 
   if (!SCK_IsIpFamilyEnabled(family))
     return INVALID_SOCK_FD;
@@ -293,7 +293,11 @@ open_socket(int family)
     return INVALID_SOCK_FD;
   }
 
-  if (!SCK_ListenOnSocket(sock_fd, CNF_GetNtsServerConnections())) {
+  /* Set the maximum number of waiting connections on the socket to the maximum
+     number of concurrent sessions */
+  backlog = MAX(CNF_GetNtsServerProcesses(), 1) * CNF_GetNtsServerConnections();
+
+  if (!SCK_ListenOnSocket(sock_fd, backlog)) {
     SCK_CloseSocket(sock_fd);
     return INVALID_SOCK_FD;
   }