summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2010-08-12 01:47:38 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-12 00:45:41 -0700
commitaa17ab8aa1851ac8848b0e36c420f6dd09fe9616 (patch)
tree34f2ec3f2b805b198e8d15381163f0165034580e /rpc/rpc-lib
parentd8bb87b4c7dd40adf4fe0ba0a0946483599e0acc (diff)
rpc: Cleanup reconnect timer while destroying rpc_clnt
Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1334 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1334
Diffstat (limited to 'rpc/rpc-lib')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index fce3e8200fe..dd28c60e0a5 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -429,6 +429,30 @@ out:
return ret;
}
+int
+rpc_clnt_reconnect_cleanup (rpc_clnt_connection_t *conn)
+{
+ struct rpc_clnt *clnt = NULL;
+
+ if (!conn) {
+ goto out;
+ }
+
+ clnt = conn->rpc_clnt;
+
+ pthread_mutex_lock (&conn->lock);
+ {
+
+ if (conn->reconnect) {
+ gf_timer_call_cancel (clnt->ctx, conn->reconnect);
+ conn->reconnect = NULL;
+ }
+
+ }
+
+out:
+ return 0;
+}
/*
* client_protocol_cleanup - cleanup function
@@ -461,10 +485,6 @@ rpc_clnt_connection_cleanup (rpc_clnt_connection_t *conn)
conn->timer = NULL;
}
- if (conn->reconnect == NULL) {
- /* :O This part is empty.. any thing missing? */
- }
-
conn->connected = 0;
}
pthread_mutex_unlock (&conn->lock);
@@ -1322,6 +1342,7 @@ void
rpc_clnt_destroy (struct rpc_clnt *rpc)
{
rpc_clnt_connection_cleanup (&rpc->conn);
+ rpc_clnt_reconnect_cleanup (&rpc->conn);
pthread_mutex_destroy (&rpc->lock);
pthread_mutex_destroy (&rpc->conn.lock);
GF_FREE (rpc);