Patchwork [BUG:1802] set keepalive for client connections

login
register
Submitter Raghavendra Bhat
Date 2010-10-09 13:11:14
Message ID <20101009131114.GA18515@dev.gluster.com>
Download mbox | patch
Permalink /patch/5397/
State Accepted
Headers show

Comments

Raghavendra Bhat - 2010-10-09 13:11:14
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
---
 xlators/mgmt/glusterd/src/glusterd-handler.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

Patch

diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index ba9aeb8..8254569 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2265,6 +2265,7 @@  glusterd_friend_add (const char *hoststr, int port,
         glusterd_peer_hostname_t *name = NULL;
         char                    *hostname = NULL;
         glusterd_peerctx_t     *peerctx = NULL;
+        int32_t                 intvl = 0;
 
         priv = THIS->private;
 
@@ -2312,6 +2313,26 @@  glusterd_friend_add (const char *hoststr, int port,
                         goto out;
                 }
 
+                ret = dict_get_int32 (THIS->options,
+                                      "transport.socket.keepalive-interval",
+                                      &intvl);
+                if (!ret) {
+                        ret = dict_set_int32 (options,
+                                "transport.socket.keepalive-interval", intvl);
+                        if (ret)
+                                goto out;
+                }
+
+                ret = dict_get_int32 (THIS->options,
+                                      "transport.socket.keepalive-time",
+                                      &intvl);
+                if (!ret) {
+                        ret = dict_set_int32 (options,
+                                "transport.socket.keepalive-time", intvl);
+                        if (ret)
+                                goto out;
+                }
+
                 hostname = gf_strdup((char*)hoststr);
                 if (!hostname) {
                         ret = -1;