summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c1
3 files changed, 8 insertions, 1 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 52316a03a58..4b01a3c0494 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -798,6 +798,8 @@ rpc_clnt_notify (rpc_transport_t *trans, void *mydata,
goto out;
}
clnt = conn->rpc_clnt;
+ if (!clnt)
+ goto out;
switch (event) {
case RPC_TRANSPORT_DISCONNECT:
@@ -1386,6 +1388,10 @@ out:
void
rpc_clnt_destroy (struct rpc_clnt *rpc)
{
+ if (!rpc)
+ return;
+
+ rpc_transport_destroy (rpc->conn.trans);
rpc_clnt_connection_cleanup (&rpc->conn);
rpc_clnt_reconnect_cleanup (&rpc->conn);
pthread_mutex_destroy (&rpc->lock);
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index 2be2de4d203..9656dba1ee8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -278,7 +278,7 @@ glusterd_ac_handle_friend_remove_req (glusterd_friend_sm_event_t *event,
ret = glusterd_xfer_friend_remove_resp (ev_ctx->req, ev_ctx->hostname,
ev_ctx->port);
- //rpc_clnt_destroy (peerinfo->rpc);
+ rpc_clnt_destroy (peerinfo->rpc);
peerinfo->rpc = NULL;
ret = glusterd_friend_sm_new_event (GD_FRIEND_EVENT_REMOVE_FRIEND,
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index ab86041d8c1..4e65a7f0f07 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -727,6 +727,7 @@ glusterd_friend_cleanup (glusterd_peerinfo_t *peerinfo)
{
GF_ASSERT (peerinfo);
if (peerinfo->rpc) {
+ rpc_clnt_destroy (peerinfo->rpc);
peerinfo->rpc = NULL;
}
glusterd_peer_destroy (peerinfo);