diff options
author | Gordon Sim <gsim@apache.org> | 2007-09-12 14:49:12 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2007-09-12 14:49:12 +0000 |
commit | 46b15e2c2f9e454fd7041f1e6ad723d093bee052 (patch) | |
tree | 34af4f367c3b5b46955ce070384a99adb742b562 /cpp/src/qpid/client/ChannelHandler.cpp | |
parent | 86255826a849d7d8ced73009274a5bee909a0923 (diff) | |
download | qpid-python-46b15e2c2f9e454fd7041f1e6ad723d093bee052.tar.gz |
In ClientChannel: Use subscribe and flush in place of get; use per-subscriber flow control for managing prefetches.
In brokers Session: set credit to 0 when subscription is created (modified python tests accordingly)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@574979 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/ChannelHandler.cpp')
-rw-r--r-- | cpp/src/qpid/client/ChannelHandler.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cpp/src/qpid/client/ChannelHandler.cpp b/cpp/src/qpid/client/ChannelHandler.cpp index 754b0544c6..c9b7a68f38 100644 --- a/cpp/src/qpid/client/ChannelHandler.cpp +++ b/cpp/src/qpid/client/ChannelHandler.cpp @@ -36,7 +36,9 @@ void ChannelHandler::incoming(AMQFrame& frame) ChannelCloseBody* closeBody= dynamic_cast<ChannelCloseBody*>(body->getMethod()); if (closeBody) { - setState(CLOSED); + setState(CLOSED_BY_PEER); + code = closeBody->getReplyCode(); + text = closeBody->getReplyText(); if (onClose) { onClose(closeBody->getReplyCode(), closeBody->getReplyText()); } @@ -65,8 +67,10 @@ void ChannelHandler::outgoing(AMQFrame& frame) if (getState() == OPEN) { frame.setChannel(id); out(frame); - } else { + } else if (getState() == CLOSED) { throw Exception("Channel not open"); + } else if (getState() == CLOSED_BY_PEER) { + throw ChannelException(code, text); } } @@ -80,7 +84,7 @@ void ChannelHandler::open(uint16_t _id) std::set<int> states; states.insert(OPEN); - states.insert(CLOSED); + states.insert(CLOSED_BY_PEER); waitFor(states); if (getState() != OPEN) { throw Exception("Failed to open channel."); |