diff options
| -rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 56 | ||||
| -rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.h | 4 | ||||
| -rw-r--r-- | rpc/rpc-lib/src/rpc-transport.c | 57 | ||||
| -rw-r--r-- | rpc/rpc-lib/src/rpc-transport.h | 4 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 4 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 8 | 
6 files changed, 67 insertions, 66 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index 55ac88a9327..c8bb8e29855 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -1669,59 +1669,3 @@ rpc_clnt_reconfig (struct rpc_clnt *rpc, struct rpc_clnt_config *config)          }  } -int -rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath, -                                       int frame_timeout) -{ -        dict_t                  *dict = NULL; -        char                    *fpath = NULL; -        int                     ret = -1; - -        GF_ASSERT (filepath); -        GF_ASSERT (options); - -        dict = dict_new (); -        if (!dict) -                goto out; - -        fpath = gf_strdup (filepath); -        if (!fpath) { -                ret = -1; -                goto out; -        } - -        ret = dict_set_dynstr (dict, "transport.socket.connect-path", fpath); -        if (ret) -                goto out; - -        ret = dict_set_str (dict, "transport.address-family", "unix"); -        if (ret) -                goto out; - -        ret = dict_set_str (dict, "transport.socket.nodelay", "off"); -        if (ret) -                goto out; - -        ret = dict_set_str (dict, "transport-type", "socket"); -        if (ret) -                goto out; - -        ret = dict_set_str (dict, "transport.socket.keepalive", "off"); -        if (ret) -                goto out; - -        if (frame_timeout > 0) { -                ret = dict_set_int32 (dict, "frame-timeout", frame_timeout); -                if (ret) -                        goto out; -        } - -        *options = dict; -out: -        if (ret) { -                GF_FREE (fpath); -                if (dict) -                        dict_unref (dict); -        } -        return ret; -} diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h index 0da1655590a..1f74e55d73e 100644 --- a/rpc/rpc-lib/src/rpc-clnt.h +++ b/rpc/rpc-lib/src/rpc-clnt.h @@ -237,10 +237,6 @@ void rpc_clnt_reconfig (struct rpc_clnt *rpc, struct rpc_clnt_config *config);  int rpcclnt_cbk_program_register (struct rpc_clnt *svc,                                    rpcclnt_cb_program_t *program, void *mydata); -int -rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath, -                                       int frame_timeout); -  void  rpc_clnt_disable (struct rpc_clnt *rpc); diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 2d64a1a1cbb..55ff0a3e865 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -559,6 +559,63 @@ out:  }  int +rpc_transport_unix_options_build (dict_t **options, char *filepath, +                                  int frame_timeout) +{ +        dict_t                  *dict = NULL; +        char                    *fpath = NULL; +        int                     ret = -1; + +        GF_ASSERT (filepath); +        GF_ASSERT (options); + +        dict = dict_new (); +        if (!dict) +                goto out; + +        fpath = gf_strdup (filepath); +        if (!fpath) { +                ret = -1; +                goto out; +        } + +        ret = dict_set_dynstr (dict, "transport.socket.connect-path", fpath); +        if (ret) +                goto out; + +        ret = dict_set_str (dict, "transport.address-family", "unix"); +        if (ret) +                goto out; + +        ret = dict_set_str (dict, "transport.socket.nodelay", "off"); +        if (ret) +                goto out; + +        ret = dict_set_str (dict, "transport-type", "socket"); +        if (ret) +                goto out; + +        ret = dict_set_str (dict, "transport.socket.keepalive", "off"); +        if (ret) +                goto out; + +        if (frame_timeout > 0) { +                ret = dict_set_int32 (dict, "frame-timeout", frame_timeout); +                if (ret) +                        goto out; +        } + +        *options = dict; +out: +        if (ret) { +                GF_FREE (fpath); +                if (dict) +                        dict_unref (dict); +        } +        return ret; +} + +int  rpc_transport_inet_options_build (dict_t **options, const char *hostname,                                    int port)  { diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index 272de9d7ddc..9e78b5a040c 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -302,5 +302,9 @@ rpc_transport_keepalive_options_set (dict_t *options, int32_t interval,                                       int32_t time);  int +rpc_transport_unix_options_build (dict_t **options, char *filepath, +                                  int frame_timeout); + +int  rpc_transport_inet_options_build (dict_t **options, const char *hostname, int port);  #endif /* __RPC_TRANSPORT_H__ */ diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 165af4e62fc..ebb9e7dd47f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -277,7 +277,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,           * default timeout of 30mins used for unreliable network connections is           * too long for unix domain socket connections.           */ -        ret = rpc_clnt_transport_unix_options_build (&options, sockfile, 600); +        ret = rpc_transport_unix_options_build (&options, sockfile, 600);          if (ret) {                  gf_log (THIS->name, GF_LOG_ERROR, "Unix options build failed");                  goto out; @@ -331,7 +331,7 @@ glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo,           * default timeout of 30mins used for unreliable network connections is           * too long for unix domain socket connections.           */ -        ret = rpc_clnt_transport_unix_options_build (&options, sockfile, 600); +        ret = rpc_transport_unix_options_build (&options, sockfile, 600);          if (ret) {                  gf_log (THIS->name, GF_LOG_ERROR, "Unix options build failed");                  goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 7970777aefd..ad19484a16d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1268,8 +1268,8 @@ glusterd_brick_connect (glusterd_volinfo_t  *volinfo,                   * The default timeout of 30mins used for unreliable network                   * connections is too long for unix domain socket connections.                   */ -                ret = rpc_clnt_transport_unix_options_build (&options, -                                                             socketpath, 600); +                ret = rpc_transport_unix_options_build (&options, socketpath, +                                                        600);                  if (ret)                          goto out;                  synclock_unlock (&priv->big_lock); @@ -3436,8 +3436,8 @@ glusterd_nodesvc_connect (char *server, char *socketpath) {                   * The default timeout of 30mins used for unreliable network                   * connections is too long for unix domain socket connections.                   */ -                ret = rpc_clnt_transport_unix_options_build (&options, -                                                             socketpath, 600); +                ret = rpc_transport_unix_options_build (&options, socketpath, +                                                        600);                  if (ret)                          goto out;                  synclock_unlock (&priv->big_lock);  | 
