diff options
author | Vijay Bellur <vijay@gluster.com> | 2010-10-08 04:54:36 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-08 04:28:44 -0700 |
commit | 99b04920189df06cfd8704a773c51cdb995b7ae0 (patch) | |
tree | bac61cfb6be363e29da58023cc968b95fb9c1d12 | |
parent | 95d595d9cbe727401021cf1caf0d59b3ab12d454 (diff) |
support for configuring keepalive idle time
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1802 (Gluster volume creation failed)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1802
-rw-r--r-- | doc/glusterd.vol | 2 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 21 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.h | 1 |
3 files changed, 19 insertions, 5 deletions
diff --git a/doc/glusterd.vol b/doc/glusterd.vol index 48cad9579a2..b96cbe8eaaf 100644 --- a/doc/glusterd.vol +++ b/doc/glusterd.vol @@ -4,6 +4,8 @@ volume management option transport-type socket,rdma option transport.socket.listen-port 6969 option transport.rdma.listen-port 6968 + option transport.socket.keepalive-time 10 + option transport.socket.keepalive-interval 2 # option listen-port 6969 end-volume diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index c5246822a7c..341c8e94a39 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -363,7 +363,7 @@ __socket_nodelay (int fd) static int -__socket_keepalive (int fd, int keepalive_intvl) +__socket_keepalive (int fd, int keepalive_intvl, int keepalive_idle) { int on = 1; int ret = -1; @@ -381,7 +381,7 @@ __socket_keepalive (int fd, int keepalive_intvl) if (ret == -1) goto err; #else - ret = setsockopt (fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepalive_intvl, + ret = setsockopt (fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepalive_idle, sizeof (keepalive_intvl)); if (ret == -1) goto err; @@ -394,7 +394,7 @@ __socket_keepalive (int fd, int keepalive_intvl) done: gf_log ("", GF_LOG_TRACE, "Keep-alive enabled for socket %d, interval " - "%d", fd, keepalive_intvl); + "%d, idle: %d", fd, keepalive_intvl, keepalive_idle); err: return ret; @@ -1802,7 +1802,8 @@ socket_server_event_handler (int fd, int idx, void *data, if (priv->keepalive) { ret = __socket_keepalive (new_sock, - priv->keepaliveintvl); + priv->keepaliveintvl, + priv->keepaliveidle); if (ret == -1) gf_log (this->name, GF_LOG_ERROR, "Failed to set keep-alive: %s", @@ -2010,7 +2011,8 @@ socket_connect (rpc_transport_t *this, int port) if (priv->keepalive) { ret = __socket_keepalive (priv->sock, - priv->keepaliveintvl); + priv->keepaliveintvl, + priv->keepaliveidle); if (ret == -1) gf_log (this->name, GF_LOG_ERROR, "Failed to set keep-alive: %s", @@ -2600,6 +2602,12 @@ socket_init (rpc_transport_t *this) priv->keepaliveintvl = keepalive; } + if (dict_get_uint32 (this->options, + "transport.socket.keepalive-time", + &keepalive) == 0) { + priv->keepaliveidle = keepalive; + } + priv->windowsize = (int)windowsize; out: this->private = priv; @@ -2699,5 +2707,8 @@ struct volume_options options[] = { { .key = {"transport.socket.keepalive-interval"}, .type = GF_OPTION_TYPE_INT }, + { .key = {"transport.socket.keepalive-time"}, + .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 f7471ffb85c..f54b64c2ad2 100644 --- a/rpc/rpc-transport/socket/src/socket.h +++ b/rpc/rpc-transport/socket/src/socket.h @@ -189,6 +189,7 @@ typedef struct { char lowlat; char nodelay; int keepalive; + int keepaliveidle; int keepaliveintvl; } socket_private_t; |