rpc: rearm listener socket early

Problem:
On node reboot, when glusterd starts volumes, a setup with a large
number of bricks might cause SYN Flooding and connections to be dropped
if the connections are not accepted quickly enough.

Solution:
accept() the connection and rearm the listener socket early to receive
more connection requests as soon as possible.

Change-Id: Ibed421e50284c3f7a8fcdb4de7ac86cf53d4b74e
fixes: bz#1564600
Signed-off-by: Milind Changire <mchangir@redhat.com>
This commit is contained in:
Milind Changire 2018-04-06 23:19:07 +05:30 committed by Raghavendra G
parent bb12f2109a
commit 6964640a97

View File

@ -2893,6 +2893,9 @@ socket_server_event_handler (int fd, int idx, int gen, void *data,
if (poll_in) {
new_sock = accept (priv->sock, SA (&new_sockaddr), &addrlen);
if (ctx)
event_handled (ctx->event_pool, fd, idx, gen);
if (new_sock == -1) {
gf_log (this->name, GF_LOG_WARNING,
"accept on %d failed (%s)",
@ -3115,9 +3118,6 @@ socket_server_event_handler (int fd, int idx, int gen, void *data,
}
}
out:
if (ctx)
event_handled (ctx->event_pool, fd, idx, gen);
if (cname && (cname != this->ssl_name)) {
GF_FREE(cname);
}