summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2009-06-03 13:52:44 +0000
committerAndrew Stitcher <astitcher@apache.org>2009-06-03 13:52:44 +0000
commitd754c14caadec49f7107c2c9233c4abccf32daa6 (patch)
tree5045107485248e56b410b6012b012c39cd5073d7 /cpp/src
parentf5e02db0308f72c71acf7d13c2d10c5d35325e0f (diff)
downloadqpid-python-d754c14caadec49f7107c2c9233c4abccf32daa6.tar.gz
Revert "QPID-1879 Removed some code obsoleted by this change"
This reverts commit 60d66cae76b2bea90f076875e35cb69049fb2d3a. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@781376 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/client/Connector.cpp10
-rw-r--r--cpp/src/qpid/client/RdmaConnector.cpp4
-rw-r--r--cpp/src/qpid/client/SslConnector.cpp9
3 files changed, 21 insertions, 2 deletions
diff --git a/cpp/src/qpid/client/Connector.cpp b/cpp/src/qpid/client/Connector.cpp
index 3e77ff2fe0..946bf0138d 100644
--- a/cpp/src/qpid/client/Connector.cpp
+++ b/cpp/src/qpid/client/Connector.cpp
@@ -40,6 +40,7 @@
#include <deque>
#include <boost/bind.hpp>
#include <boost/format.hpp>
+#include <boost/weak_ptr.hpp>
namespace qpid {
namespace client {
@@ -100,6 +101,7 @@ class TCPConnector : public Connector, public sys::Codec
framing::ProtocolVersion version;
bool initiated;
bool closed;
+ bool joined;
sys::ShutdownHandler* shutdownHandler;
framing::InputHandler* input;
@@ -123,6 +125,8 @@ class TCPConnector : public Connector, public sys::Codec
void writeDataBlock(const framing::AMQDataBlock& data);
void eof(qpid::sys::AsynchIO&);
+ boost::weak_ptr<ConnectionImpl> impl;
+
void connect(const std::string& host, int port);
void init();
void close();
@@ -176,9 +180,11 @@ TCPConnector::TCPConnector(Poller::shared_ptr p,
version(ver),
initiated(false),
closed(true),
+ joined(true),
shutdownHandler(0),
aio(0),
- poller(p)
+ poller(p),
+ impl(cimpl->shared_from_this())
{
QPID_LOG(debug, "TCPConnector created for " << version.toString());
settings.configureSocket(socket);
@@ -211,8 +217,10 @@ void TCPConnector::connect(const std::string& host, int port){
void TCPConnector::init(){
Mutex::ScopedLock l(lock);
+ assert(joined);
ProtocolInitiation init(version);
writeDataBlock(init);
+ joined = false;
for (int i = 0; i < 32; i++) {
aio->queueReadBuffer(new Buff(maxFrameSize));
}
diff --git a/cpp/src/qpid/client/RdmaConnector.cpp b/cpp/src/qpid/client/RdmaConnector.cpp
index 15d6e5364d..f6bedf63f5 100644
--- a/cpp/src/qpid/client/RdmaConnector.cpp
+++ b/cpp/src/qpid/client/RdmaConnector.cpp
@@ -68,6 +68,7 @@ using boost::str;
sys::Mutex pollingLock;
bool polling;
+ bool joined;
sys::ShutdownHandler* shutdownHandler;
framing::InputHandler* input;
@@ -147,6 +148,7 @@ RdmaConnector::RdmaConnector(Poller::shared_ptr p,
version(ver),
initiated(false),
polling(false),
+ joined(true),
shutdownHandler(0),
aio(0),
poller(p),
@@ -162,6 +164,7 @@ RdmaConnector::~RdmaConnector() {
void RdmaConnector::connect(const std::string& host, int port){
Mutex::ScopedLock l(pollingLock);
assert(!polling);
+ assert(joined);
// This stuff needs to abstracted out of here to a platform specific file
::addrinfo *res;
@@ -185,6 +188,7 @@ void RdmaConnector::connect(const std::string& host, int port){
c->start(poller);
polling = true;
+ joined = false;
}
// The following only gets run when connected
diff --git a/cpp/src/qpid/client/SslConnector.cpp b/cpp/src/qpid/client/SslConnector.cpp
index 635de1f62d..8194371b8a 100644
--- a/cpp/src/qpid/client/SslConnector.cpp
+++ b/cpp/src/qpid/client/SslConnector.cpp
@@ -89,6 +89,7 @@ class SslConnector : public Connector
sys::Mutex closedLock;
bool closed;
+ bool joined;
sys::ShutdownHandler* shutdownHandler;
framing::InputHandler* input;
@@ -114,6 +115,8 @@ class SslConnector : public Connector
std::string identifier;
+ ConnectionImpl* impl;
+
void connect(const std::string& host, int port);
void init();
void close();
@@ -171,10 +174,12 @@ SslConnector::SslConnector(Poller::shared_ptr p,
version(ver),
initiated(false),
closed(true),
+ joined(true),
shutdownHandler(0),
writer(maxFrameSize, cimpl),
aio(0),
- poller(p)
+ poller(p),
+ impl(cimpl)
{
QPID_LOG(debug, "SslConnector created for " << version.toString());
//TODO: how do we want to handle socket configuration with ssl?
@@ -209,8 +214,10 @@ void SslConnector::connect(const std::string& host, int port){
void SslConnector::init(){
Mutex::ScopedLock l(closedLock);
+ assert(joined);
ProtocolInitiation init(version);
writeDataBlock(init);
+ joined = false;
for (int i = 0; i < 32; i++) {
aio->queueReadBuffer(new Buff(maxFrameSize));
}