diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2008-09-11 04:45:26 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2008-09-11 04:45:26 +0000 |
| commit | 468b4b6ddaa3d96bb743cdbd27ded651eea31847 (patch) | |
| tree | f1987d223e56792386f884029664dae277bff754 /cpp/src/qpid/client/ConnectionImpl.cpp | |
| parent | 51ea054146d0af71640bd44e8e75494847216a31 (diff) | |
| download | qpid-python-468b4b6ddaa3d96bb743cdbd27ded651eea31847.tar.gz | |
Refactored c++ client library to allow multiple protocols to be
used simultaneously:
- Added in capability for client library plugins:
Client library will load in plugin modules from
the client library module directory on library load.
- Add protocol option into the standard client command line options
- Split plugin module load area into daemon and client;
default daemon module directory is now <libdir>/qpid/daemon,
default client module directory is <libdir>/qpid/client.
- Changed names of plugins to leave out libqpid prefix
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@694113 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/ConnectionImpl.cpp')
| -rw-r--r-- | cpp/src/qpid/client/ConnectionImpl.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp index f623530f98..f180c4f23e 100644 --- a/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/ConnectionImpl.cpp @@ -40,7 +40,6 @@ using namespace qpid::framing::connection;//for connection error codes ConnectionImpl::ConnectionImpl(framing::ProtocolVersion v, const ConnectionSettings& settings) : Bounds(settings.maxFrameSize * settings.bounds), handler(settings, v), - connector(new Connector(v, settings, this)), version(v) { QPID_LOG(debug, "ConnectionImpl created for " << version); @@ -48,8 +47,6 @@ ConnectionImpl::ConnectionImpl(framing::ProtocolVersion v, const ConnectionSetti handler.out = boost::bind(&Connector::send, boost::ref(connector), _1); handler.onClose = boost::bind(&ConnectionImpl::closed, this, CLOSE_CODE_NORMAL, std::string()); - connector->setInputHandler(&handler); - connector->setShutdownHandler(this); //only set error handler once open handler.onError = boost::bind(&ConnectionImpl::closed, this, _1, _2); @@ -59,7 +56,7 @@ ConnectionImpl::~ConnectionImpl() { // Important to close the connector first, to ensure the // connector thread does not call on us while the destructor // is running. - connector->close(); + if (connector) connector->close(); } void ConnectionImpl::addSession(const boost::shared_ptr<SessionImpl>& session) @@ -93,9 +90,16 @@ bool ConnectionImpl::isOpen() const } -void ConnectionImpl::open(const std::string& host, int port) +void ConnectionImpl::open() { - QPID_LOG(info, "Connecting to " << host << ":" << port); + const std::string& protocol = handler.protocol; + const std::string& host = handler.host; + int port = handler.port; + QPID_LOG(info, "Connecting to " << protocol << ":" << host << ":" << port); + + connector.reset(Connector::create(protocol, version, handler, this)); + connector->setInputHandler(&handler); + connector->setShutdownHandler(this); connector->connect(host, port); connector->init(); handler.waitForOpen(); |
