From 3485fe658a38634178747791cf1575c0ec80e9f6 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 16 Apr 2010 18:16:30 +0000 Subject: Ensure that ConnectionImpl is notified of shutdown even in the case of disconnect (which needs different handling than eof) git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@935017 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/TCPConnector.cpp | 7 ++++++- cpp/src/qpid/client/TCPConnector.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/client/TCPConnector.cpp b/cpp/src/qpid/client/TCPConnector.cpp index 3ead7e2ce0..d0a12c8522 100644 --- a/cpp/src/qpid/client/TCPConnector.cpp +++ b/cpp/src/qpid/client/TCPConnector.cpp @@ -104,7 +104,7 @@ void TCPConnector::connected(const Socket&) { aio = AsynchIO::create(socket, boost::bind(&TCPConnector::readbuff, this, _1, _2), boost::bind(&TCPConnector::eof, this, _1), - boost::bind(&TCPConnector::eof, this, _1), + boost::bind(&TCPConnector::disconnected, this, _1), boost::bind(&TCPConnector::socketClosed, this, _1, _2), 0, // nobuffs boost::bind(&TCPConnector::writebuff, this, _1)); @@ -313,6 +313,11 @@ void TCPConnector::eof(AsynchIO&) { close(); } +void TCPConnector::disconnected(AsynchIO&) { + close(); + socketClosed(*aio, socket); +} + void TCPConnector::activateSecurityLayer(std::auto_ptr sl) { securityLayer = sl; diff --git a/cpp/src/qpid/client/TCPConnector.h b/cpp/src/qpid/client/TCPConnector.h index 04504a5173..bce5f593c6 100644 --- a/cpp/src/qpid/client/TCPConnector.h +++ b/cpp/src/qpid/client/TCPConnector.h @@ -104,6 +104,7 @@ protected: bool readbuff(qpid::sys::AsynchIO&, qpid::sys::AsynchIOBufferBase*); void writebuff(qpid::sys::AsynchIO&); void eof(qpid::sys::AsynchIO&); + void disconnected(qpid::sys::AsynchIO&); void socketClosed(qpid::sys::AsynchIO&, const qpid::sys::Socket&); public: -- cgit v1.2.1