summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/Connector.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-05-23 13:39:07 +0000
committerAlan Conway <aconway@apache.org>2008-05-23 13:39:07 +0000
commit896d94f7c27e958806b96b537a7a96208ede145a (patch)
tree35c139fcc037fde8fef675d9d730882d22781931 /cpp/src/qpid/client/Connector.cpp
parentbb4584d228b837fa70839560d72bc2a59dc1aa17 (diff)
downloadqpid-python-896d94f7c27e958806b96b537a7a96208ede145a.tar.gz
qpid::SessionState: Added error checking for invalid frame sequences.
client: Fix client crash on error during connection shutdown. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@659538 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/Connector.cpp')
-rw-r--r--cpp/src/qpid/client/Connector.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/cpp/src/qpid/client/Connector.cpp b/cpp/src/qpid/client/Connector.cpp
index c9c55c50e8..793809fc7c 100644
--- a/cpp/src/qpid/client/Connector.cpp
+++ b/cpp/src/qpid/client/Connector.cpp
@@ -21,6 +21,7 @@
#include "Connector.h"
#include "Bounds.h"
+#include "ConnectionImpl.h"
#include "ConnectionSettings.h"
#include "qpid/log/Statement.h"
#include "qpid/sys/Time.h"
@@ -42,7 +43,9 @@ using namespace qpid::framing;
using boost::format;
using boost::str;
-Connector::Connector(ProtocolVersion ver, const ConnectionSettings& settings, Bounds* bounds)
+Connector::Connector(ProtocolVersion ver,
+ const ConnectionSettings& settings,
+ ConnectionImpl* cimpl)
: maxFrameSize(settings.maxFrameSize),
version(ver),
initiated(false),
@@ -52,8 +55,9 @@ Connector::Connector(ProtocolVersion ver, const ConnectionSettings& settings, Bo
idleIn(0), idleOut(0),
timeoutHandler(0),
shutdownHandler(0),
- writer(maxFrameSize, bounds),
- aio(0)
+ writer(maxFrameSize, cimpl),
+ aio(0),
+ impl(cimpl)
{
QPID_LOG(debug, "Connector created for " << version);
socket.configure(settings);
@@ -294,6 +298,9 @@ void Connector::eof(AsynchIO&) {
// TODO: astitcher 20070908 This version of the code can never time out, so the idle processing
// will never be called
void Connector::run(){
+ // Keep the connection impl in memory until run() completes.
+ boost::shared_ptr<ConnectionImpl> protect = impl->shared_from_this();
+ assert(protect);
try {
Dispatcher d(poller);