summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/ConnectionCodec.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-09-21 05:04:04 +0000
committerAlan Conway <aconway@apache.org>2008-09-21 05:04:04 +0000
commit558e92d6c9cf8dfb875c1250ab8fe1cefaf30b05 (patch)
tree9b306597ee07b264fa18580546ed5645f0c3766d /cpp/src/qpid/cluster/ConnectionCodec.cpp
parent7c70d21ca2d788d4432cfa89851c9b928c9f30aa (diff)
downloadqpid-python-558e92d6c9cf8dfb875c1250ab8fe1cefaf30b05.tar.gz
DumpClient send connections & session IDs to new members.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@697446 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/ConnectionCodec.cpp')
-rw-r--r--cpp/src/qpid/cluster/ConnectionCodec.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/cpp/src/qpid/cluster/ConnectionCodec.cpp b/cpp/src/qpid/cluster/ConnectionCodec.cpp
index d95a321adf..accf83ebc7 100644
--- a/cpp/src/qpid/cluster/ConnectionCodec.cpp
+++ b/cpp/src/qpid/cluster/ConnectionCodec.cpp
@@ -25,6 +25,7 @@
#include "qpid/broker/Connection.h"
#include "qpid/log/Statement.h"
#include "qpid/memory.h"
+#include <stdexcept>
namespace qpid {
namespace cluster {
@@ -57,8 +58,18 @@ ConnectionCodec::~ConnectionCodec() {}
// ConnectionCodec functions delegate to the codecOutput
size_t ConnectionCodec::decode(const char* buffer, size_t size) {
- if (interceptor->isCatchUp())
- return codec.decode(buffer, size);
+ if (interceptor->isShadow())
+ throw Exception(QPID_MSG("Unexpected decode for shadow connection " << *interceptor));
+ else if (interceptor->isCatchUp()) {
+ size_t ret = codec.decode(buffer, size);
+ if (interceptor->isShadow()) {
+ // Promoted to shadow, close the codec.
+ // FIXME aconway 2008-09-19: can we close cleanly?
+ // codec.close();
+ throw Exception("Close codec");
+ }
+ return ret;
+ }
else
return interceptor->decode(buffer, size);
}