diff options
author | Ken Giusti <kgiusti@apache.org> | 2015-06-03 16:04:07 +0000 |
---|---|---|
committer | Ken Giusti <kgiusti@apache.org> | 2015-06-03 16:04:07 +0000 |
commit | 45fad1afcd22b1a8375bf59bcccf871c577ee972 (patch) | |
tree | 90bf402d11ab1da922ae419b9ddff9cb162ea497 /cpp | |
parent | e979d61362210fa4746ea3f1a99ef255034b5cfb (diff) | |
download | qpid-python-45fad1afcd22b1a8375bf59bcccf871c577ee972.tar.gz |
QPID-6563: free sessions and links that have completely closed
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1683379 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/broker/amqp/Connection.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/amqp/Connection.cpp b/cpp/src/qpid/broker/amqp/Connection.cpp index 5593f755e5..8e2bc86e51 100644 --- a/cpp/src/qpid/broker/amqp/Connection.cpp +++ b/cpp/src/qpid/broker/amqp/Connection.cpp @@ -442,10 +442,14 @@ void Connection::process() processDeliveries(); - for (pn_link_t* l = pn_link_head(connection, REQUIRES_CLOSE); l; l = pn_link_next(l, REQUIRES_CLOSE)) { + for (pn_link_t* l = pn_link_head(connection, REQUIRES_CLOSE), *next = 0; + l; l = next) { + next = pn_link_next(l, REQUIRES_CLOSE); doLinkRemoteClose(l); } - for (pn_session_t* s = pn_session_head(connection, REQUIRES_CLOSE); s; s = pn_session_next(s, REQUIRES_CLOSE)) { + for (pn_session_t* s = pn_session_head(connection, REQUIRES_CLOSE), *next = 0; + s; s = next) { + next = pn_session_next(s, REQUIRES_CLOSE); doSessionRemoteClose(s); } if ((pn_connection_state(connection) & REQUIRES_CLOSE) == REQUIRES_CLOSE) { @@ -537,6 +541,7 @@ void Connection::doSessionRemoteClose(pn_session_t *session) QPID_LOG(error, id << " peer attempted to close unrecognised session"); } } + pn_session_free(session); } // the peer has issued an Attach performative @@ -587,6 +592,7 @@ void Connection::doLinkRemoteClose(pn_link_t *link) QPID_LOG_CAT(debug, model, id << " link detached"); } } + pn_link_free(link); } // the status of the delivery has changed |