diff options
| author | Alan Conway <aconway@apache.org> | 2008-08-05 19:29:09 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-08-05 19:29:09 +0000 |
| commit | b5f8cf1bd9b5652e2691d6bc5b9b1c3228f53d68 (patch) | |
| tree | 3c74eaf22c916844bea3b130a8ee6bd2635261d7 /cpp/src/qpid/cluster/Cluster.cpp | |
| parent | bd47fd629bb2356df93af70b174a6a070f3a58cc (diff) | |
| download | qpid-python-b5f8cf1bd9b5652e2691d6bc5b9b1c3228f53d68.tar.gz | |
Fix Cluster::send encode race.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@682885 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/Cluster.cpp')
| -rw-r--r-- | cpp/src/qpid/cluster/Cluster.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index d18fd452e4..1d81a50e1c 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -109,8 +109,7 @@ template <class T> void encodePtr(Buffer& buf, T* ptr) { void Cluster::send(const AMQFrame& frame, ConnectionInterceptor* connection) { QPID_LOG(trace, "MCAST [" << connection << "] " << frame); - // FIXME aconway 2008-07-03: More efficient buffer management. - // Cache coded form of decoded frames for re-encoding? + char buffer[64*1024]; // FIXME aconway 2008-07-04: buffer management. Buffer buf(buffer); frame.encode(buf); encodePtr(buf, connection); @@ -161,7 +160,8 @@ void Cluster::deliver( try { Buffer buf(static_cast<char*>(msg), msg_len); AMQFrame frame; - frame.decode(buf); + if (!frame.decode(buf)) // Not enough data. + throw Exception("Received incomplete cluster event."); // FIXME aconway 2008-08-05: cluster error handling. ConnectionInterceptor* connection; decodePtr(buf, connection); QPID_LOG(trace, "DLVR [" << from << " " << connection << "] " << frame); @@ -170,7 +170,6 @@ void Cluster::deliver( QPID_LOG(warning, "Unexpected DLVR, already left the cluster."); return; } - if (connection && from != self) // Look up shadow for remote connections connection = getShadowConnection(from, connection); |
