From bc5441acda9f35bef338677868e46145ce7a418b Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 24 Jun 2010 17:19:58 +0000 Subject: Fix regression in r956882, sporadic failures of client_test.cpp:testBadClientData git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@957640 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/cluster/Connection.cpp | 23 +++++++++-------------- qpid/cpp/src/qpid/cluster/Connection.h | 2 +- qpid/cpp/xml/cluster.xml | 4 +--- 3 files changed, 11 insertions(+), 18 deletions(-) (limited to 'qpid/cpp') diff --git a/qpid/cpp/src/qpid/cluster/Connection.cpp b/qpid/cpp/src/qpid/cluster/Connection.cpp index 42f800bd18..d4f0a06eaf 100644 --- a/qpid/cpp/src/qpid/cluster/Connection.cpp +++ b/qpid/cpp/src/qpid/cluster/Connection.cpp @@ -262,7 +262,7 @@ void Connection::closed() { // until self-delivery of deliver-close. output.closeOutput(); cluster.getMulticast().mcastControl( - ClusterConnectionDeliverCloseBody(ProtocolVersion(), false), self); + ClusterConnectionDeliverCloseBody(), self); } } catch (const std::exception& e) { @@ -271,31 +271,26 @@ void Connection::closed() { } // Self-delivery of close message, close the connection. -void Connection::deliverClose (bool aborted) { - QPID_LOG(debug, cluster << " replicated close of " << *this); - if (connection.get()) { - if (aborted) connection->abort(); - else connection->closed(); - connection.reset(); - } +void Connection::deliverClose () { + close(); cluster.erase(self); } // Close the connection void Connection::close() { - QPID_LOG(debug, cluster << " local close of " << *this); if (connection.get()) { + QPID_LOG(debug, cluster << " closed connection " << *this); connection->closed(); connection.reset(); } } -// The connection has been killed for misbehaving, called in connection thread. +// The connection has sent invalid data and should be aborted. +// All members will get the same abort since they all process the same data. void Connection::abort() { - if (connection.get()) { - cluster.getMulticast().mcastControl( - ClusterConnectionDeliverCloseBody(ProtocolVersion(), true), self); - } + connection->abort(); + // Aborting the connection will result in a call to ::closed() + // and allow the connection to close in an orderly manner. } // ConnectionCodec::decode receives read buffers from directly-connected clients. diff --git a/qpid/cpp/src/qpid/cluster/Connection.h b/qpid/cpp/src/qpid/cluster/Connection.h index 72a98c12f1..aec18d73a4 100644 --- a/qpid/cpp/src/qpid/cluster/Connection.h +++ b/qpid/cpp/src/qpid/cluster/Connection.h @@ -170,7 +170,7 @@ class Connection : const std::string& initFrames); void close(); void abort(); - void deliverClose(bool); + void deliverClose(); OutputInterceptor& getOutput() { return output; } diff --git a/qpid/cpp/xml/cluster.xml b/qpid/cpp/xml/cluster.xml index 25ad978e8e..30cd159dd3 100644 --- a/qpid/cpp/xml/cluster.xml +++ b/qpid/cpp/xml/cluster.xml @@ -134,9 +134,7 @@ - - - + -- cgit v1.2.1