diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/lib/broker/Connection.cpp | 6 | ||||
-rw-r--r-- | cpp/lib/broker/Connection.h | 2 | ||||
-rw-r--r-- | cpp/lib/broker/Reference.cpp | 2 | ||||
-rw-r--r-- | cpp/lib/broker/Reference.h | 3 | ||||
-rw-r--r-- | cpp/lib/client/IncomingMessage.cpp | 20 | ||||
-rw-r--r-- | cpp/lib/common/framing/InitiationHandler.h | 2 | ||||
-rw-r--r-- | cpp/lib/common/sys/apr/LFSessionContext.cpp | 2 | ||||
-rw-r--r-- | cpp/tests/BrokerChannelTest.cpp | 2 | ||||
-rw-r--r-- | cpp/tests/InProcessBroker.h | 2 |
9 files changed, 21 insertions, 20 deletions
diff --git a/cpp/lib/broker/Connection.cpp b/cpp/lib/broker/Connection.cpp index ae0114cba9..dbc8149cb5 100644 --- a/cpp/lib/broker/Connection.cpp +++ b/cpp/lib/broker/Connection.cpp @@ -76,15 +76,15 @@ void Connection::close( getOutput().close(); } -void Connection::initiated(framing::ProtocolInitiation* header) { - version = ProtocolVersion(header->getMajor(), header->getMinor()); +void Connection::initiated(const framing::ProtocolInitiation& header) { + version = ProtocolVersion(header.getMajor(), header.getMinor()); FieldTable properties; string mechanisms("PLAIN"); string locales("en_US"); getChannel(0).init(0, *out, getVersion()); client = &getChannel(0).getAdatper().getProxy().getConnection(); client->start( - header->getMajor(), header->getMinor(), + header.getMajor(), header.getMinor(), properties, mechanisms, locales); } diff --git a/cpp/lib/broker/Connection.h b/cpp/lib/broker/Connection.h index 1314ccbd97..5c6f40ca54 100644 --- a/cpp/lib/broker/Connection.h +++ b/cpp/lib/broker/Connection.h @@ -81,7 +81,7 @@ class Connection : public sys::ConnectionInputHandler, // ConnectionInputHandler methods void received(framing::AMQFrame* frame); - void initiated(framing::ProtocolInitiation* header); + void initiated(const framing::ProtocolInitiation& header); void idleOut(); void idleIn(); void closed(); diff --git a/cpp/lib/broker/Reference.cpp b/cpp/lib/broker/Reference.cpp index c4c33e6363..bd1bdcb007 100644 --- a/cpp/lib/broker/Reference.cpp +++ b/cpp/lib/broker/Reference.cpp @@ -28,8 +28,6 @@ namespace broker { Reference::shared_ptr ReferenceRegistry::open(const Reference::Id& id) { ReferenceMap::iterator i = references.find(id); - // TODO aconway 2007-02-05: should we throw Channel or Connection - // exceptions here? if (i != references.end()) throw ConnectionException(503, "Attempt to re-open reference " +id); return references[id] = Reference::shared_ptr(new Reference(id, this)); diff --git a/cpp/lib/broker/Reference.h b/cpp/lib/broker/Reference.h index e453645a54..277eb7b917 100644 --- a/cpp/lib/broker/Reference.h +++ b/cpp/lib/broker/Reference.h @@ -36,6 +36,9 @@ namespace broker { class MessageMessage; class ReferenceRegistry; +// FIXME aconway 2007-03-27: Merge with client::IncomingMessage +// to common reference handling code. + /** * A reference is an accumulation point for data in a multi-frame * message. A reference can be used by multiple transfer commands to diff --git a/cpp/lib/client/IncomingMessage.cpp b/cpp/lib/client/IncomingMessage.cpp index 8f69f8c3ef..fb9640b61b 100644 --- a/cpp/lib/client/IncomingMessage.cpp +++ b/cpp/lib/client/IncomingMessage.cpp @@ -35,8 +35,8 @@ IncomingMessage::Destination::~Destination() {} void IncomingMessage::openReference(const std::string& name) { Mutex::ScopedLock l(lock); if (references.find(name) != references.end()) - throw ChannelException( - 406, format("Attempt to open existing reference %s.") % name); + throw ConnectionException( + 503, format("Attempt to open existing reference %s.") % name); references[name]; return; } @@ -84,16 +84,16 @@ void IncomingMessage::addDestination(std::string name, Destination& dest) { if (i == destinations.end()) destinations[name]=&dest; else if (i->second != &dest) - throw ChannelException( - 404, format("Destination already exists: %s.") % name); + throw ConnectionException( + 503, format("Destination already exists: %s.") % name); } void IncomingMessage::removeDestination(std::string name) { Mutex::ScopedLock l(lock); DestinationMap::iterator i = destinations.find(name); if (i == destinations.end()) - throw ChannelException( - 406, format("No such destination: %s.") % name); + throw ConnectionException( + 503, format("No such destination: %s.") % name); destinations.erase(i); } @@ -112,8 +112,8 @@ IncomingMessage::Reference& IncomingMessage::getRefUnlocked( Mutex::ScopedLock l(lock); ReferenceMap::iterator i = references.find(name); if (i == references.end()) - throw ChannelException( - 404, format("No such reference: %s.") % name); + throw ConnectionException( + 503, format("No such reference: %s.") % name); return i->second; } @@ -122,8 +122,8 @@ IncomingMessage::Destination& IncomingMessage::getDestUnlocked( Mutex::ScopedLock l(lock); DestinationMap::iterator i = destinations.find(name); if (i == destinations.end()) - throw ChannelException( - 404, format("No such destination: %s.") % name); + throw ConnectionException( + 503, format("No such destination: %s.") % name); return *i->second; } diff --git a/cpp/lib/common/framing/InitiationHandler.h b/cpp/lib/common/framing/InitiationHandler.h index d94fc58d2c..7f44323f09 100644 --- a/cpp/lib/common/framing/InitiationHandler.h +++ b/cpp/lib/common/framing/InitiationHandler.h @@ -31,7 +31,7 @@ namespace framing { class InitiationHandler{ public: virtual ~InitiationHandler(); - virtual void initiated(ProtocolInitiation* header) = 0; + virtual void initiated(const ProtocolInitiation&) = 0; }; } diff --git a/cpp/lib/common/sys/apr/LFSessionContext.cpp b/cpp/lib/common/sys/apr/LFSessionContext.cpp index 503dfddbb7..5edb72baee 100644 --- a/cpp/lib/common/sys/apr/LFSessionContext.cpp +++ b/cpp/lib/common/sys/apr/LFSessionContext.cpp @@ -71,7 +71,7 @@ void LFSessionContext::read(){ }else{ ProtocolInitiation protocolInit; if(protocolInit.decode(in)){ - handler->initiated(&protocolInit); + handler->initiated(protocolInit); initiated = true; if(debug) std::cout << "INIT [" << &socket << "]" << std::endl; } diff --git a/cpp/tests/BrokerChannelTest.cpp b/cpp/tests/BrokerChannelTest.cpp index 9216ae4672..8717be07b5 100644 --- a/cpp/tests/BrokerChannelTest.cpp +++ b/cpp/tests/BrokerChannelTest.cpp @@ -146,7 +146,7 @@ class BrokerChannelTest : public CppUnit::TestCase broker(Broker::create()), connection(&handler, *broker) { - connection.initiated(new ProtocolInitiation()); + connection.initiated(ProtocolInitiation()); } diff --git a/cpp/tests/InProcessBroker.h b/cpp/tests/InProcessBroker.h index 833b821d11..e2b426347b 100644 --- a/cpp/tests/InProcessBroker.h +++ b/cpp/tests/InProcessBroker.h @@ -85,7 +85,7 @@ class InProcessBroker : public client::Connector { ~InProcessBroker() { broker->shutdown(); } void connect(const std::string& /*host*/, int /*port*/) {} - void init() { brokerConnection.initiated(&protocolInit); } + void init() { brokerConnection.initiated(protocolInit); } void close() {} /** Client's input handler. */ |