From 558e92d6c9cf8dfb875c1250ab8fe1cefaf30b05 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Sun, 21 Sep 2008 05:04:04 +0000 Subject: 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 --- cpp/src/qpid/cluster/ConnectionCodec.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'cpp/src/qpid/cluster/ConnectionCodec.cpp') 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 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); } -- cgit v1.2.1