qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject qpid-dispatch git commit: DISPATCH-177 - Free up connection work items when a connection is closed.
Date Fri, 01 Apr 2016 19:47:50 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 31220576d -> be393a3f2


DISPATCH-177 - Free up connection work items when a connection is closed.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/be393a3f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/be393a3f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/be393a3f

Branch: refs/heads/master
Commit: be393a3f21bc1ddd1a4fd493bed046958e5b4cea
Parents: 3122057
Author: Ted Ross <tross@redhat.com>
Authored: Fri Apr 1 15:47:00 2016 -0400
Committer: Ted Ross <tross@redhat.com>
Committed: Fri Apr 1 15:47:00 2016 -0400

----------------------------------------------------------------------
 src/router_core/connections.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/be393a3f/src/router_core/connections.c
----------------------------------------------------------------------
diff --git a/src/router_core/connections.c b/src/router_core/connections.c
index 1920b89..60ae71a 100644
--- a/src/router_core/connections.c
+++ b/src/router_core/connections.c
@@ -881,21 +881,28 @@ static void qdr_connection_closed_CT(qdr_core_t *core, qdr_action_t
*action, boo
     //
     qdr_link_ref_t *link_ref = DEQ_HEAD(conn->links);
     while (link_ref) {
-        //
-        // TODO - if the link is link-routed and has a peer, detach the peer.
-        //
+        qdr_link_t *link = link_ref->link;
 
         //
         // Clean up the link and all its associated state.
         //
-        qdr_link_cleanup_CT(core, conn, link_ref->link);
-        free_qdr_link_t(link_ref->link);
+        qdr_link_cleanup_CT(core, conn, link); // link_cleanup disconnects and frees the
ref.
+        free_qdr_link_t(link);
         link_ref = DEQ_HEAD(conn->links);
     }
 
     //
     // Discard items on the work list
     //
+    qdr_connection_work_t *work = DEQ_HEAD(conn->work_list);
+    while (work) {
+        DEQ_REMOVE_HEAD(conn->work_list);
+        qdr_terminus_free(work->source);
+        qdr_terminus_free(work->target);
+        qdr_error_free(work->error);
+        free_qdr_connection_work_t(work);
+        work = DEQ_HEAD(conn->work_list);
+    }
 
     DEQ_REMOVE(core->open_connections, conn);
     sys_mutex_free(conn->work_lock);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message