summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/TCPConnector.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2012-10-24 05:51:31 +0000
committerAndrew Stitcher <astitcher@apache.org>2012-10-24 05:51:31 +0000
commite9af3d4c50c322615b9486fdccde807a621648c7 (patch)
treeda83a8d381028880ab45f6486ade1cf8baa096b3 /cpp/src/qpid/client/TCPConnector.cpp
parent29d3d257a0df2e3f9d0386e534411c7f3806fa85 (diff)
downloadqpid-python-e9af3d4c50c322615b9486fdccde807a621648c7.tar.gz
QPID-4272: Large amounts of code are duplicated between the SSL and TCP transports
Lift Socket into an interface with concrete implementations - BSDSocket, WinSocket and SslSocket - As a side effect completely change the approach we use for platform specific handles: IOHandle now directly carries the platform handle but its real type is only exposed to platform specific code. - Modified RDMA code for the new IOHandle approach git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1401559 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/TCPConnector.cpp')
-rw-r--r--cpp/src/qpid/client/TCPConnector.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/cpp/src/qpid/client/TCPConnector.cpp b/cpp/src/qpid/client/TCPConnector.cpp
index a14acb214c..b92f342b74 100644
--- a/cpp/src/qpid/client/TCPConnector.cpp
+++ b/cpp/src/qpid/client/TCPConnector.cpp
@@ -72,12 +72,13 @@ TCPConnector::TCPConnector(Poller::shared_ptr p,
closed(true),
shutdownHandler(0),
input(0),
+ socket(createSocket()),
connector(0),
aio(0),
poller(p)
{
QPID_LOG(debug, "TCPConnector created for " << version);
- settings.configureSocket(socket);
+ settings.configureSocket(*socket);
}
TCPConnector::~TCPConnector() {
@@ -88,7 +89,7 @@ void TCPConnector::connect(const std::string& host, const std::string& port) {
Mutex::ScopedLock l(lock);
assert(closed);
connector = AsynchConnector::create(
- socket,
+ *socket,
host, port,
boost::bind(&TCPConnector::connected, this, _1),
boost::bind(&TCPConnector::connectFailed, this, _3));
@@ -99,7 +100,7 @@ void TCPConnector::connect(const std::string& host, const std::string& port) {
void TCPConnector::connected(const Socket&) {
connector = 0;
- aio = AsynchIO::create(socket,
+ aio = AsynchIO::create(*socket,
boost::bind(&TCPConnector::readbuff, this, _1, _2),
boost::bind(&TCPConnector::eof, this, _1),
boost::bind(&TCPConnector::disconnected, this, _1),
@@ -116,7 +117,7 @@ void TCPConnector::start(sys::AsynchIO* aio_) {
aio->createBuffers(maxFrameSize);
- identifier = str(format("[%1%]") % socket.getFullAddress());
+ identifier = str(format("[%1%]") % socket->getFullAddress());
}
void TCPConnector::initAmqp() {
@@ -127,7 +128,7 @@ void TCPConnector::initAmqp() {
void TCPConnector::connectFailed(const std::string& msg) {
connector = 0;
QPID_LOG(warning, "Connect failed: " << msg);
- socket.close();
+ socket->close();
if (!closed)
closed = true;
if (shutdownHandler)
@@ -318,7 +319,7 @@ void TCPConnector::eof(AsynchIO&) {
void TCPConnector::disconnected(AsynchIO&) {
close();
- socketClosed(*aio, socket);
+ socketClosed(*aio, *socket);
}
void TCPConnector::activateSecurityLayer(std::auto_ptr<qpid::sys::SecurityLayer> sl)