From 0dec073336cc31a5158ce8e5354943bd2638afd2 Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Mon, 30 May 2011 09:58:24 +0000 Subject: rpc: Introduce option for listen()'s backlog Signed-off-by: Vijay Bellur Signed-off-by: Anand Avati BUG: 2941 (glusterd breaks when starting ~100 volumes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2941 --- rpc/rpc-transport/socket/src/socket.c | 15 ++++++++++++++- rpc/rpc-transport/socket/src/socket.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'rpc') diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 4ae49815a58..12e4fc6a6e7 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -2174,7 +2174,10 @@ socket_listen (rpc_transport_t *this) goto unlock; } - ret = listen (priv->sock, 10); + if (priv->backlog) + ret = listen (priv->sock, priv->backlog); + else + ret = listen (priv->sock, 10); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, @@ -2498,6 +2501,7 @@ socket_init (rpc_transport_t *this) uint64_t windowsize = GF_DEFAULT_SOCKET_WINDOW_SIZE; char *optstr = NULL; uint32_t keepalive = 0; + uint32_t backlog = 0; if (this->private) { gf_log (this->name, GF_LOG_DEBUG, @@ -2608,6 +2612,12 @@ socket_init (rpc_transport_t *this) priv->keepaliveidle = keepalive; } + if (dict_get_uint32 (this->options, + "transport.socket.listen-backlog", + &backlog) == 0) { + priv->backlog = backlog; + } + priv->windowsize = (int)windowsize; out: this->private = priv; @@ -2710,5 +2720,8 @@ struct volume_options options[] = { { .key = {"transport.socket.keepalive-time"}, .type = GF_OPTION_TYPE_INT }, + { .key = {"transport.socket.listen-backlog"}, + .type = GF_OPTION_TYPE_INT + }, { .key = {NULL} } }; diff --git a/rpc/rpc-transport/socket/src/socket.h b/rpc/rpc-transport/socket/src/socket.h index c43c5576c3b..871106a676c 100644 --- a/rpc/rpc-transport/socket/src/socket.h +++ b/rpc/rpc-transport/socket/src/socket.h @@ -192,6 +192,7 @@ typedef struct { int keepalive; int keepaliveidle; int keepaliveintvl; + uint32_t backlog; } socket_private_t; -- cgit