diff options
| author | Alan Conway <aconway@apache.org> | 2007-09-18 20:42:36 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-09-18 20:42:36 +0000 |
| commit | 6d8a7813e9b75b3dd870b1e815cb5b78ef6da8ee (patch) | |
| tree | b1fb80e2784f19f5864b7184e33048247bc58dd2 /cpp/src | |
| parent | bbeef2a9aa82a1986af36e0ca25d7fec39592921 (diff) | |
| download | qpid-python-6d8a7813e9b75b3dd870b1e815cb5b78ef6da8ee.tar.gz | |
Eliminate ChannelAdapter from broker code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@577048 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
| -rw-r--r-- | cpp/src/qpid/broker/Connection.h | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/ConnectionAdapter.cpp | 36 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/ConnectionAdapter.h | 16 |
3 files changed, 16 insertions, 37 deletions
diff --git a/cpp/src/qpid/broker/Connection.h b/cpp/src/qpid/broker/Connection.h index f4e9eec331..94651701dd 100644 --- a/cpp/src/qpid/broker/Connection.h +++ b/cpp/src/qpid/broker/Connection.h @@ -29,7 +29,6 @@ #include "qpid/framing/AMQFrame.h" #include "qpid/framing/AMQP_ServerOperations.h" #include "qpid/framing/AMQP_ClientProxy.h" -#include "qpid/framing/ChannelAdapter.h" #include "qpid/sys/ConnectionOutputHandler.h" #include "qpid/sys/ConnectionInputHandler.h" #include "qpid/sys/TimeoutHandler.h" diff --git a/cpp/src/qpid/broker/ConnectionAdapter.cpp b/cpp/src/qpid/broker/ConnectionAdapter.cpp index c38800f458..e33aeda8c7 100644 --- a/cpp/src/qpid/broker/ConnectionAdapter.cpp +++ b/cpp/src/qpid/broker/ConnectionAdapter.cpp @@ -22,17 +22,13 @@ #include "ConnectionAdapter.h" #include "Connection.h" -#include "qpid/framing/ChannelAdapter.h" +#include "qpid/framing/ConnectionStartBody.h" using namespace qpid; using namespace qpid::broker; -using qpid::framing::ReplyCode; -using qpid::framing::ClassId; -using qpid::framing::MethodId; -using qpid::framing::FieldTable; +using namespace qpid::framing; void ConnectionAdapter::init(const framing::ProtocolInitiation& header) { - ChannelAdapter::init(0, handler->connection.getOutput(), handler->connection.getVersion()); FieldTable properties; string mechanisms("PLAIN"); string locales("en_US"); @@ -44,16 +40,6 @@ void ConnectionAdapter::close(ReplyCode code, const string& text, ClassId classI handler->client.close(code, text, classId, methodId); } -void ConnectionAdapter::handleMethod(framing::AMQMethodBody* method) -{ - try{ - method->invoke(*this); - }catch(ConnectionException& e){ - handler->client.close(e.code, e.toString(), method->amqpClassId(), method->amqpMethodId()); - }catch(std::exception& e){ - handler->client.close(541/*internal error*/, e.what(), method->amqpClassId(), method->amqpMethodId()); - } -} framing::AMQP_ServerOperations::ConnectionHandler* ConnectionAdapter::getConnectionHandler() { @@ -67,17 +53,19 @@ framing::ProtocolVersion ConnectionAdapter::getVersion() const void ConnectionAdapter::handle(framing::AMQFrame& frame) { - getHandlers().in(frame); -} - -ConnectionAdapter::ConnectionAdapter(Connection& connection) -{ - handler = std::auto_ptr<Handler>(new Handler(connection, *this)); + AMQMethodBody* method=frame.getBody()->getMethod(); + try{ + method->invoke(*this); + }catch(ConnectionException& e){ + handler->client.close(e.code, e.toString(), method->amqpClassId(), method->amqpMethodId()); + }catch(std::exception& e){ + handler->client.close(541/*internal error*/, e.what(), method->amqpClassId(), method->amqpMethodId()); + } } -ConnectionAdapter::Handler:: Handler(Connection& c, ConnectionAdapter& a) : - proxy(a.getHandlers().out), client(proxy.getConnection()), connection(c) {} +ConnectionAdapter::ConnectionAdapter(Connection& connection) : handler(new Handler(connection)) {} +ConnectionAdapter::Handler:: Handler(Connection& c) : client(c.getOutput()), connection(c) {} void ConnectionAdapter::Handler::startOk(const FieldTable& /*clientProperties*/, const string& /*mechanism*/, diff --git a/cpp/src/qpid/broker/ConnectionAdapter.h b/cpp/src/qpid/broker/ConnectionAdapter.h index e3102faf59..eb96575c9d 100644 --- a/cpp/src/qpid/broker/ConnectionAdapter.h +++ b/cpp/src/qpid/broker/ConnectionAdapter.h @@ -26,7 +26,7 @@ #include "qpid/framing/AMQFrame.h" #include "qpid/framing/AMQP_ServerOperations.h" #include "qpid/framing/AMQP_ClientProxy.h" -#include "qpid/framing/ChannelAdapter.h" +#include "qpid/framing/FrameHandler.h" #include "qpid/framing/ProtocolInitiation.h" #include "qpid/framing/ProtocolVersion.h" #include "qpid/Exception.h" @@ -36,15 +36,15 @@ namespace broker { class Connection; -class ConnectionAdapter : public framing::ChannelAdapter, public framing::AMQP_ServerOperations +// TODO aconway 2007-09-18: Rename to ConnectionHandler +class ConnectionAdapter : public framing::FrameHandler, public framing::AMQP_ServerOperations { struct Handler : public framing::AMQP_ServerOperations::ConnectionHandler { - framing::AMQP_ClientProxy proxy; framing::AMQP_ClientProxy::Connection client; Connection& connection; - Handler(Connection& connection, ConnectionAdapter& adapter); + Handler(Connection& connection); void startOk(const qpid::framing::FieldTable& clientProperties, const std::string& mechanism, const std::string& response, const std::string& locale); @@ -63,14 +63,6 @@ class ConnectionAdapter : public framing::ChannelAdapter, public framing::AMQP_S void close(framing::ReplyCode code, const std::string& text, framing::ClassId classId, framing::MethodId methodId); void handle(framing::AMQFrame& frame); - //ChannelAdapter virtual methods: - void handleMethod(framing::AMQMethodBody* method); - bool isOpen() const { return true; } //channel 0 is always open - //never needed: - void handleHeader(framing::AMQHeaderBody*) {} - void handleContent(framing::AMQContentBody*) {} - void handleHeartbeat(framing::AMQHeartbeatBody*) {} - //AMQP_ServerOperations: ConnectionHandler* getConnectionHandler(); ChannelHandler* getChannelHandler() { throw ConnectionException(503, "Class can't be accessed over channel 0"); } |
