diff options
author | Gordon Sim <gsim@apache.org> | 2008-03-26 12:14:18 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-03-26 12:14:18 +0000 |
commit | 9222ac0989bffebe53706255314fa4c577d2b6d8 (patch) | |
tree | 7b71d235c5c67fbe9c6d1e1c496194d52ce42102 /cpp | |
parent | 7cc09e96c680aa54c9d988844604f4fa7328c770 (diff) | |
download | qpid-python-9222ac0989bffebe53706255314fa4c577d2b6d8.tar.gz |
Re-enable the establishment of inter-broker links.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@641281 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/broker/ConnectionFactory.cpp | 7 | ||||
-rw-r--r-- | cpp/src/qpid/broker/PreviewConnection.cpp | 11 | ||||
-rw-r--r-- | cpp/src/qpid/broker/PreviewConnection.h | 3 | ||||
-rw-r--r-- | cpp/src/qpid/broker/PreviewConnectionCodec.cpp | 4 | ||||
-rw-r--r-- | cpp/src/qpid/broker/PreviewConnectionCodec.h | 2 | ||||
-rw-r--r-- | cpp/src/qpid/broker/PreviewConnectionHandler.cpp | 11 | ||||
-rw-r--r-- | cpp/src/qpid/broker/PreviewConnectionHandler.h | 2 | ||||
-rw-r--r-- | cpp/src/qpid/sys/AsynchIOAcceptor.cpp | 4 |
8 files changed, 22 insertions, 22 deletions
diff --git a/cpp/src/qpid/broker/ConnectionFactory.cpp b/cpp/src/qpid/broker/ConnectionFactory.cpp index dfab998c78..cb831f3023 100644 --- a/cpp/src/qpid/broker/ConnectionFactory.cpp +++ b/cpp/src/qpid/broker/ConnectionFactory.cpp @@ -43,8 +43,11 @@ ConnectionFactory::create(ProtocolVersion v, sys::OutputControl& out, const std: sys::ConnectionCodec* ConnectionFactory::create(sys::OutputControl& out, const std::string& id) { - // FIXME aconway 2008-03-18: - return new PreviewConnectionCodec(out, broker, id); + // FIXME aconway 2008-03-18: + + // gsim 2008-03-26 this seems only to be used when creating + // connections from one broker to another + return new PreviewConnectionCodec(out, broker, id, true); } }} // namespace qpid::broker diff --git a/cpp/src/qpid/broker/PreviewConnection.cpp b/cpp/src/qpid/broker/PreviewConnection.cpp index 5a541b5624..f5a629248c 100644 --- a/cpp/src/qpid/broker/PreviewConnection.cpp +++ b/cpp/src/qpid/broker/PreviewConnection.cpp @@ -85,17 +85,12 @@ public: }; -PreviewConnection::PreviewConnection(ConnectionOutputHandler* out_, Broker& broker_, const std::string& mgmtId_) : +PreviewConnection::PreviewConnection(ConnectionOutputHandler* out_, Broker& broker_, const std::string& mgmtId_, bool isLink) : ConnectionState(out_, broker_), - adapter(*this), + adapter(*this, isLink), mgmtClosing(0), mgmtId(mgmtId_) { - initMgmt(); -} - -void PreviewConnection::initMgmt(bool asLink) -{ Manageable* parent = broker.GetVhostObject (); if (parent != 0) @@ -104,7 +99,7 @@ void PreviewConnection::initMgmt(bool asLink) if (agent.get () != 0) { - if (asLink) { + if (isLink) { mgmtWrapper = std::auto_ptr<MgmtWrapper>(new MgmtLink(this, parent, agent, mgmtId)); } else { mgmtWrapper = std::auto_ptr<MgmtWrapper>(new MgmtClient(this, parent, agent, mgmtId)); diff --git a/cpp/src/qpid/broker/PreviewConnection.h b/cpp/src/qpid/broker/PreviewConnection.h index 1cc9e7a3d4..89b9907715 100644 --- a/cpp/src/qpid/broker/PreviewConnection.h +++ b/cpp/src/qpid/broker/PreviewConnection.h @@ -53,7 +53,7 @@ namespace broker { class PreviewConnection : public sys::ConnectionInputHandler, public ConnectionState { public: - PreviewConnection(sys::ConnectionOutputHandler* out, Broker& broker, const std::string& mgmtId); + PreviewConnection(sys::ConnectionOutputHandler* out, Broker& broker, const std::string& mgmtId, bool isLink = false); ~PreviewConnection (); /** Get the PreviewSessionHandler for channel. Create if it does not already exist */ @@ -76,7 +76,6 @@ class PreviewConnection : public sys::ConnectionInputHandler, public ConnectionS management::Manageable::status_t ManagementMethod (uint32_t methodId, management::Args& args); - void initMgmt(bool asLink = false); private: typedef boost::ptr_map<framing::ChannelId, PreviewSessionHandler> ChannelMap; diff --git a/cpp/src/qpid/broker/PreviewConnectionCodec.cpp b/cpp/src/qpid/broker/PreviewConnectionCodec.cpp index 81ec7f7076..d3a5281109 100644 --- a/cpp/src/qpid/broker/PreviewConnectionCodec.cpp +++ b/cpp/src/qpid/broker/PreviewConnectionCodec.cpp @@ -26,8 +26,8 @@ namespace broker { using sys::Mutex; -PreviewConnectionCodec::PreviewConnectionCodec(sys::OutputControl& o, Broker& broker, const std::string& id) - : frameQueueClosed(false), output(o), connection(this, broker, id), identifier(id) {} +PreviewConnectionCodec::PreviewConnectionCodec(sys::OutputControl& o, Broker& broker, const std::string& id, bool isClient) + : frameQueueClosed(false), output(o), connection(this, broker, id, isClient), identifier(id) {} size_t PreviewConnectionCodec::decode(const char* buffer, size_t size) { framing::Buffer in(const_cast<char*>(buffer), size); diff --git a/cpp/src/qpid/broker/PreviewConnectionCodec.h b/cpp/src/qpid/broker/PreviewConnectionCodec.h index 8c7074c1df..f2ab086d06 100644 --- a/cpp/src/qpid/broker/PreviewConnectionCodec.h +++ b/cpp/src/qpid/broker/PreviewConnectionCodec.h @@ -38,7 +38,7 @@ class PreviewConnectionCodec : public sys::ConnectionCodec, public sys::Connect std::string identifier; public: - PreviewConnectionCodec(sys::OutputControl&, Broker&, const std::string& id); + PreviewConnectionCodec(sys::OutputControl&, Broker&, const std::string& id, bool isClient = false); size_t decode(const char* buffer, size_t size); size_t encode(const char* buffer, size_t size); bool isClosed() const; diff --git a/cpp/src/qpid/broker/PreviewConnectionHandler.cpp b/cpp/src/qpid/broker/PreviewConnectionHandler.cpp index 0052b0d588..78ea2f5523 100644 --- a/cpp/src/qpid/broker/PreviewConnectionHandler.cpp +++ b/cpp/src/qpid/broker/PreviewConnectionHandler.cpp @@ -60,12 +60,16 @@ void PreviewConnectionHandler::handle(framing::AMQFrame& frame) } } -PreviewConnectionHandler::PreviewConnectionHandler(PreviewConnection& connection) : handler(new Handler(connection)) { +PreviewConnectionHandler::PreviewConnectionHandler(PreviewConnection& connection, bool isClient) : handler(new Handler(connection)) { FieldTable properties; string mechanisms(PLAIN); string locales(en_US); - handler->serverMode = true; - handler->client.start(0, 10, properties, mechanisms, locales); + if (isClient) { + handler->serverMode = false; + }else { + handler->serverMode = true; + handler->client.start(99, 0, properties, mechanisms, locales); + } } PreviewConnectionHandler::Handler:: Handler(PreviewConnection& c) : client(c.getOutput()), server(c.getOutput()), @@ -128,7 +132,6 @@ void PreviewConnectionHandler::Handler::start(uint8_t /*versionMajor*/, string pwd = "qpidd"; string response = ((char)0) + uid + ((char)0) + pwd; server.startOk(FieldTable(), PLAIN, response, en_US); - connection.initMgmt(true); } void PreviewConnectionHandler::Handler::secure(const string& /*challenge*/) diff --git a/cpp/src/qpid/broker/PreviewConnectionHandler.h b/cpp/src/qpid/broker/PreviewConnectionHandler.h index bd6b54e8f7..7c3636373a 100644 --- a/cpp/src/qpid/broker/PreviewConnectionHandler.h +++ b/cpp/src/qpid/broker/PreviewConnectionHandler.h @@ -80,7 +80,7 @@ class PreviewConnectionHandler : public framing::FrameHandler }; std::auto_ptr<Handler> handler; public: - PreviewConnectionHandler(PreviewConnection& connection); + PreviewConnectionHandler(PreviewConnection& connection, bool isClient); void close(framing::ReplyCode code, const std::string& text, framing::ClassId classId, framing::MethodId methodId); void handle(framing::AMQFrame& frame); }; diff --git a/cpp/src/qpid/sys/AsynchIOAcceptor.cpp b/cpp/src/qpid/sys/AsynchIOAcceptor.cpp index 56d7c6e1f3..f74541d29a 100644 --- a/cpp/src/qpid/sys/AsynchIOAcceptor.cpp +++ b/cpp/src/qpid/sys/AsynchIOAcceptor.cpp @@ -211,7 +211,7 @@ void AsynchIOAcceptor::shutdown() { void AsynchIOHandler::write(const framing::ProtocolInitiation& data) { - QPID_LOG(debug, "SENT [" << identifier << "] INIT( " << data << ")"); + QPID_LOG(debug, "SENT [" << identifier << "] INIT(" << data << ")"); AsynchIO::BufferBase* buff = aio->getQueuedBuffer(); if (!buff) buff = new Buff; @@ -244,7 +244,7 @@ void AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) { framing::ProtocolInitiation protocolInit; if (protocolInit.decode(in)) { decoded = in.getPosition(); - QPID_LOG(debug, "RECV [" << identifier << "] INIT( " << protocolInit << ")"); + QPID_LOG(debug, "RECV [" << identifier << "] INIT(" << protocolInit << ")"); codec = factory->create(protocolInit.getVersion(), *this, identifier); if (!codec) { // FIXME aconway 2008-03-18: send valid version header & close connection. |