summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Giusti <kgiusti@apache.org>2015-06-03 16:04:07 +0000
committerKen Giusti <kgiusti@apache.org>2015-06-03 16:04:07 +0000
commit3fb144cc7da60cf0d7a8f1bbb684b89e71349e14 (patch)
treed56173b06a1ecf5c4697964a50a983f301c0c095
parentf913124de7556991e43ba6df5de8d9808ad55ef2 (diff)
downloadqpid-python-3fb144cc7da60cf0d7a8f1bbb684b89e71349e14.tar.gz
QPID-6563: free sessions and links that have completely closed
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1683379 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/Connection.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/broker/amqp/Connection.cpp b/qpid/cpp/src/qpid/broker/amqp/Connection.cpp
index 5593f755e5..8e2bc86e51 100644
--- a/qpid/cpp/src/qpid/broker/amqp/Connection.cpp
+++ b/qpid/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