summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2011-05-30 10:46:43 +0000
committerAnand Avati <avati@gluster.com>2011-05-31 09:13:11 -0700
commitb66af70226748ea81c09ffe316bfb9a71e7f1820 (patch)
tree9dce39d1a64d32f137136d348e7f6c52867e948e /rpc/rpc-transport
parent7e7ce674472c7154ab5c86a373287a2c734c0e3c (diff)
rpc: Introduce option for listen()'s backlog
Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2941 (glusterd breaks when starting ~100 volumes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2941
Diffstat (limited to 'rpc/rpc-transport')
-rw-r--r--rpc/rpc-transport/socket/src/socket.c15
-rw-r--r--rpc/rpc-transport/socket/src/socket.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index a8d329f2242..5b7d57b3d4d 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -2212,7 +2212,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,
@@ -2510,6 +2513,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_callingfn (this->name, GF_LOG_ERROR,
@@ -2617,6 +2621,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;
@@ -2719,5 +2729,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 0bdc95db5c9..4acecab2a61 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;