From 292067c024adf53c704fe3b7d3e336c76fc18ff3 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 26 Jan 2010 23:56:40 +0000 Subject: Make TCP more like RDMA git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@903503 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/TCPConnector.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/client/TCPConnector.cpp b/cpp/src/qpid/client/TCPConnector.cpp index 94c4a4cae0..78c9b32069 100644 --- a/cpp/src/qpid/client/TCPConnector.cpp +++ b/cpp/src/qpid/client/TCPConnector.cpp @@ -139,8 +139,8 @@ void TCPConnector::connectFailed(const std::string& msg) { bool TCPConnector::closeInternal() { Mutex::ScopedLock l(lock); bool ret = !closed; - if (!closed) { - closed = true; + closed = true; + if (ret) { if (aio) aio->queueForDeletion(); socket.close(); @@ -186,18 +186,20 @@ const std::string& TCPConnector::getIdentifier() const { } void TCPConnector::send(AMQFrame& frame) { + bool notifyWrite = false; + { Mutex::ScopedLock l(lock); frames.push_back(frame); //only ask to write if this is the end of a frameset or if we //already have a buffers worth of data currentSize += frame.encodedSize(); - bool notifyWrite = false; if (frame.getEof()) { lastEof = frames.size(); notifyWrite = true; } else { notifyWrite = (currentSize >= maxFrameSize); } + } if (notifyWrite && !closed) aio->notifyPendingWrite(); } -- cgit v1.2.1