summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c2
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c50
2 files changed, 7 insertions, 45 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index 50379c14950..b8ef434503b 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -1171,6 +1171,8 @@ rpc_transport_destroy (rpc_transport_t *this)
GF_VALIDATE_OR_GOTO("rpc_transport", this, fail);
+ rpc_transport_disconnect (this);
+
if (this->fini)
this->fini (this);
pthread_mutex_destroy (&this->lock);
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 5bb908cec0a..09ff68daa60 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -603,57 +603,17 @@ out:
void
rpcsvc_conn_destroy (rpcsvc_conn_t *conn)
{
- rpcsvc_notify_wrapper_t *wrapper = NULL;
- rpcsvc_event_t event = 0;
rpcsvc_listener_t *listener = NULL;
- rpcsvc_t *svc = NULL;
- rpcsvc_notify_wrapper_t *wrappers = NULL;
- int i = 0, wrapper_count = 0;
- if (!conn)
+ if (!conn || !conn->rxpool || !conn->listener)
goto out;
+ if (conn->trans)
+ rpc_transport_destroy (conn->trans);
+
mem_pool_destroy (conn->rxpool);
listener = conn->listener;
- if (!listener)
- goto out;
-
- event = (listener->conn == conn) ? RPCSVC_EVENT_LISTENER_DEAD
- : RPCSVC_EVENT_DISCONNECT;
-
- svc = conn->svc;
- if (!svc)
- goto out;
-
- pthread_mutex_lock (&svc->rpclock);
- {
- wrappers = GF_CALLOC (svc->notify_count, sizeof (*wrapper),
- gf_common_mt_rpcsvc_wrapper_t);
- if (!wrappers) {
- goto unlock;
- }
-
- list_for_each_entry (wrapper, &conn->listener->list,
- list) {
- if (wrapper->notify) {
- wrappers[i++] = *wrapper;
- }
- }
- wrapper_count = i;
- }
-unlock:
- pthread_mutex_unlock (&svc->rpclock);
-
- if (wrappers) {
- for (i = 0; i < wrapper_count; i++) {
- wrappers[i].notify (conn->svc, wrappers[i].data,
- event, conn);
- }
-
- GF_FREE (wrappers);
- }
-
if (listener->conn == conn) {
rpcsvc_listener_destroy (listener);
}
@@ -1232,7 +1192,7 @@ rpcsvc_notify (rpc_transport_t *trans, void *mydata,
break;
case RPC_TRANSPORT_DISCONNECT:
- //rpcsvc_conn_deinit (conn);
+ rpcsvc_conn_deinit (conn);
ret = 0;
break;