diff options
-rw-r--r-- | xlators/protocol/client/src/client-handshake.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index a3cb325b0..c249516a9 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -254,35 +254,40 @@ client_ping_cbk (struct rpc_req *req, struct iovec *iov, int count, clnt_conf_t *conf = NULL; if (!myframe) { - gf_log (THIS->name, GF_LOG_WARNING, "frame with the request is NULL"); + gf_log (THIS->name, GF_LOG_WARNING, + "frame with the request is NULL"); goto out; } frame = myframe; this = frame->this; if (!this || !this->private) { - gf_log (THIS->name, GF_LOG_WARNING, "xlator private is not set"); + gf_log (THIS->name, GF_LOG_WARNING, + "xlator private is not set"); goto out; } conf = this->private; conn = &conf->rpc->conn; - if (req->rpc_status == -1) { - if (conn->ping_timer != NULL) { - gf_log (this->name, GF_LOG_WARNING, "socket or ib" - " related error"); - gf_timer_call_cancel (this->ctx, conn->ping_timer); - conn->ping_timer = NULL; - } else { - /* timer expired and transport bailed out */ - gf_log (this->name, GF_LOG_WARNING, "timer must have " - "expired"); - } - goto out; - } - pthread_mutex_lock (&conn->lock); { + if (req->rpc_status == -1) { + if (conn->ping_timer != NULL) { + gf_log (this->name, GF_LOG_WARNING, + "socket or ib related error"); + gf_timer_call_cancel (this->ctx, + conn->ping_timer); + conn->ping_timer = NULL; + } else { + /* timer expired and transport bailed out */ + gf_log (this->name, GF_LOG_WARNING, + "timer must have expired"); + } + + goto unlock; + } + + timeout.tv_sec = conf->opt.ping_timeout; timeout.tv_usec = 0; @@ -297,6 +302,7 @@ client_ping_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_log (this->name, GF_LOG_WARNING, "failed to set the ping timer"); } +unlock: pthread_mutex_unlock (&conn->lock); out: if (frame) |