diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/cluster.mk | 1 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/Cluster.cpp | 4 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/Connection.cpp | 1 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/Event.cpp | 2 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/EventFrame.cpp | 46 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/EventFrame.h | 15 |
6 files changed, 58 insertions, 11 deletions
diff --git a/cpp/src/cluster.mk b/cpp/src/cluster.mk index 3809c86090..9c76bb2239 100644 --- a/cpp/src/cluster.mk +++ b/cpp/src/cluster.mk @@ -57,6 +57,7 @@ cluster_la_SOURCES = \ qpid/cluster/Event.cpp \ qpid/cluster/Event.h \ qpid/cluster/EventFrame.h \ + qpid/cluster/EventFrame.cpp \ qpid/cluster/FailoverExchange.cpp \ qpid/cluster/FailoverExchange.h \ qpid/cluster/Multicaster.cpp \ diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index 0d082fc226..2939b0c203 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -234,12 +234,12 @@ void Cluster::deliveredEvent(const Event& e) { } void Cluster::deliveredFrame(const EventFrame& e) { + QPID_LOG(trace, *this << " DLVR: " << e); QPID_LATENCY_RECORD("delivered frame queue", e.frame); - if (e.connection) { + if (e.connection) { e.connection->deliveredFrame(e); } else { - QPID_LOG(trace, *this << " DLVR: " << e.frame); Mutex::ScopedLock l(lock); // FIXME aconway 2008-12-11: lock scope too big? ClusterDispatcher dispatch(*this, e.member, l); if (!framing::invoke(dispatch, *e.frame.getBody()).wasHandled()) diff --git a/cpp/src/qpid/cluster/Connection.cpp b/cpp/src/qpid/cluster/Connection.cpp index 4b3e6da3fb..9016e812be 100644 --- a/cpp/src/qpid/cluster/Connection.cpp +++ b/cpp/src/qpid/cluster/Connection.cpp @@ -155,7 +155,6 @@ void Connection::deliveredEvent(const Event& e, PollableFrameQueue& frameq) { // Delivered from cluster. void Connection::deliveredFrame(const EventFrame& f) { - QPID_LOG(trace, cluster << " DLVR: " << *this << ": " << f.frame); assert(!catchUp); currentChannel = f.frame.getChannel(); if (!framing::invoke(*this, *f.frame.getBody()).wasHandled() // Connection contol. diff --git a/cpp/src/qpid/cluster/Event.cpp b/cpp/src/qpid/cluster/Event.cpp index 339c1de1dd..e30b961b3e 100644 --- a/cpp/src/qpid/cluster/Event.cpp +++ b/cpp/src/qpid/cluster/Event.cpp @@ -111,7 +111,7 @@ Event::operator Buffer() const { static const char* EVENT_TYPE_NAMES[] = { "data", "control" }; std::ostream& operator << (std::ostream& o, const EventHeader& e) { - o << "[event " << e.getConnectionId() + o << "[event " << e.getConnectionId() << "/" << e.getSequence() << " " << EVENT_TYPE_NAMES[e.getType()] << " " << e.getSize() << " bytes]"; return o; diff --git a/cpp/src/qpid/cluster/EventFrame.cpp b/cpp/src/qpid/cluster/EventFrame.cpp new file mode 100644 index 0000000000..c1f96ad1b2 --- /dev/null +++ b/cpp/src/qpid/cluster/EventFrame.cpp @@ -0,0 +1,46 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include "EventFrame.h" +#include "Connection.h" + +namespace qpid { +namespace cluster { + +EventFrame::EventFrame() : sequence(0) {} + +EventFrame::EventFrame( + const boost::intrusive_ptr<Connection>& c, const Event& e, + const framing::AMQFrame& f, int rc +) : connection(c), member(e.getMemberId()), frame(f), + sequence(e.getSequence()), readCredit(rc) +{ + QPID_LATENCY_INIT(frame); +} + +std::ostream& operator<<(std::ostream& o, const EventFrame& e) { + if (e.connection) + o << e.connection->getId(); + else + o << e.member; + return o << "/" << e.sequence << " " << e.frame << " rc=" << e.readCredit; +} + +}} // namespace qpid::cluster diff --git a/cpp/src/qpid/cluster/EventFrame.h b/cpp/src/qpid/cluster/EventFrame.h index 2420a2b1e5..2ef33b9695 100644 --- a/cpp/src/qpid/cluster/EventFrame.h +++ b/cpp/src/qpid/cluster/EventFrame.h @@ -27,6 +27,7 @@ #include "qpid/framing/AMQFrame.h" #include "qpid/sys/LatencyMetric.h" #include <boost/intrusive_ptr.hpp> +#include <iosfwd> namespace qpid { namespace cluster { @@ -38,13 +39,10 @@ class Connection; */ struct EventFrame { - EventFrame() : sequence(0) {} - // Connection event frame - EventFrame(const boost::intrusive_ptr<Connection>& c, const Event& e, const framing::AMQFrame& f, int rc=0) - : connection(c), member(e.getMemberId()), frame(f), sequence(e.getSequence()), readCredit(rc) - { - QPID_LATENCY_INIT(frame); - } + EventFrame(); + + EventFrame(const boost::intrusive_ptr<Connection>& c, const Event& e, + const framing::AMQFrame& f, int rc=0); bool isCluster() const { return !connection; } bool isConnection() const { return connection; } @@ -63,6 +61,9 @@ struct EventFrame uint64_t sequence; int readCredit; // last frame in an event, give credit when processed. }; + +std::ostream& operator<<(std::ostream& o, const EventFrame& e); + }} // namespace qpid::cluster #endif /*!QPID_CLUSTER_EVENTFRAME_H*/ |