mirror of
https://github.com/systemd/systemd
synced 2024-07-21 18:24:38 +00:00
Merge pull request #32140 from YHNdnzj/socket-per-peer-source
Minor tweaks to socket manual & shorten the code a bit
This commit is contained in:
commit
b1b5d7e4bf
|
@ -460,14 +460,10 @@
|
|||
|
||||
<varlistentry>
|
||||
<term><varname>MaxConnections=</varname></term>
|
||||
<listitem><para>The maximum number of connections to
|
||||
simultaneously run services instances for, when
|
||||
<option>Accept=yes</option> is set. If more concurrent
|
||||
connections are coming in, they will be refused until at least
|
||||
one existing connection is terminated. This setting has no
|
||||
effect on sockets configured with
|
||||
<option>Accept=no</option> or datagram sockets. Defaults to
|
||||
64.</para></listitem>
|
||||
<listitem><para>The maximum number of connections to simultaneously run services instances for, when
|
||||
<option>Accept=yes</option> is set. If more concurrent connections are coming in, they will be refused
|
||||
until at least one existing connection is terminated. This setting has no effect on sockets configured
|
||||
with <option>Accept=no</option> or datagram sockets. Defaults to 64.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
@ -475,7 +471,7 @@
|
|||
<listitem><para>The maximum number of connections for a service per source IP address (in case of
|
||||
IPv4/IPv6), per source CID (in case of <constant>AF_VSOCK</constant>), or source UID (in case of
|
||||
<constant>AF_UNIX</constant>). This is very similar to the <varname>MaxConnections=</varname>
|
||||
directive above. Disabled by default.</para>
|
||||
directive above. Defaults to 0, i.e. disabled.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v232"/>
|
||||
</listitem>
|
||||
|
|
|
@ -1405,8 +1405,8 @@ static int service_collect_fds(
|
|||
|
||||
UNIT_FOREACH_DEPENDENCY(u, UNIT(s), UNIT_ATOM_TRIGGERED_BY) {
|
||||
_cleanup_free_ int *cfds = NULL;
|
||||
Socket *sock;
|
||||
int cn_fds;
|
||||
Socket *sock;
|
||||
|
||||
sock = SOCKET(u);
|
||||
if (!sock)
|
||||
|
@ -1422,18 +1422,8 @@ static int service_collect_fds(
|
|||
if (!rfds) {
|
||||
rfds = TAKE_PTR(cfds);
|
||||
rn_socket_fds = cn_fds;
|
||||
} else {
|
||||
int *t;
|
||||
|
||||
t = reallocarray(rfds, rn_socket_fds + cn_fds, sizeof(int));
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(t + rn_socket_fds, cfds, cn_fds * sizeof(int));
|
||||
|
||||
rfds = t;
|
||||
rn_socket_fds += cn_fds;
|
||||
}
|
||||
} else if (!GREEDY_REALLOC_APPEND(rfds, rn_socket_fds, cfds, cn_fds))
|
||||
return -ENOMEM;
|
||||
|
||||
r = strv_extend_n(&rfd_names, socket_fdname(sock), cn_fds);
|
||||
if (r < 0)
|
||||
|
|
Loading…
Reference in a new issue