summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/ConnectionImpl.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2008-07-09 20:36:17 +0000
committerAndrew Stitcher <astitcher@apache.org>2008-07-09 20:36:17 +0000
commit2212c5a5b56466491986220ddd6a3aa4e81ff4e4 (patch)
treeb1104abc063d7cf0d869ce7be74e5e84474d2c88 /cpp/src/qpid/client/ConnectionImpl.cpp
parent9575428feb2a81323f0426361830bc543eba29db (diff)
downloadqpid-python-2212c5a5b56466491986220ddd6a3aa4e81ff4e4.tar.gz
Some small changes which clean up header file inclusions
and generally start to tidy up the network layer so that it's a bit easier to implement new network transports git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@675338 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/ConnectionImpl.cpp')
-rw-r--r--cpp/src/qpid/client/ConnectionImpl.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp
index 6dca4dcf21..f32e21c389 100644
--- a/cpp/src/qpid/client/ConnectionImpl.cpp
+++ b/cpp/src/qpid/client/ConnectionImpl.cpp
@@ -19,6 +19,7 @@
*
*/
#include "ConnectionImpl.h"
+#include "Connector.h"
#include "ConnectionSettings.h"
#include "SessionImpl.h"
@@ -38,7 +39,7 @@ 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(v, settings, this),
+ connector(new Connector(v, settings, this)),
version(v),
isClosed(true),//closed until successfully opened
isClosing(false)
@@ -48,9 +49,9 @@ ConnectionImpl::ConnectionImpl(framing::ProtocolVersion v, const ConnectionSetti
handler.out = boost::bind(&Connector::send, boost::ref(connector), _1);
handler.onClose = boost::bind(&ConnectionImpl::closed, this,
NORMAL, std::string());
- connector.setInputHandler(&handler);
- connector.setTimeoutHandler(this);
- connector.setShutdownHandler(this);
+ connector->setInputHandler(&handler);
+ connector->setTimeoutHandler(this);
+ connector->setShutdownHandler(this);
//only set error handler once open
handler.onError = boost::bind(&ConnectionImpl::closed, this, _1, _2);
@@ -60,7 +61,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();
+ connector->close();
}
void ConnectionImpl::addSession(const boost::shared_ptr<SessionImpl>& session)
@@ -97,8 +98,8 @@ bool ConnectionImpl::isOpen() const
void ConnectionImpl::open(const std::string& host, int port)
{
QPID_LOG(info, "Connecting to " << host << ":" << port);
- connector.connect(host, port);
- connector.init();
+ connector->connect(host, port);
+ connector->init();
handler.waitForOpen();
Mutex::ScopedLock l(lock);
isClosed = false;
@@ -112,7 +113,7 @@ void ConnectionImpl::idleIn()
void ConnectionImpl::idleOut()
{
AMQFrame frame(in_place<AMQHeartbeatBody>());
- connector.send(frame);
+ connector->send(frame);
}
void ConnectionImpl::close()
@@ -130,8 +131,8 @@ void ConnectionImpl::close()
template <class F> void ConnectionImpl::closeInternal(const F& f) {
isClosed = true;
- connector.close();
- for (SessionMap::iterator i=sessions.begin(); i != sessions.end(); ++i) {
+ connector->close();
+ for (SessionMap::iterator i = sessions.begin(); i != sessions.end(); ++i) {
boost::shared_ptr<SessionImpl> s = i->second.lock();
if (s) f(s);
}