summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-10-02 10:36:28 +0000
committerGordon Sim <gsim@apache.org>2007-10-02 10:36:28 +0000
commit20afd0e67c8df4c2eadcf2a9fdfdc8e0fdefac75 (patch)
tree3fcca8cbd763478c7fc44e22a6ec49155c06ddbf
parent943be55754cfc22c3d3b164b92b30b062d383484 (diff)
downloadqpid-python-20afd0e67c8df4c2eadcf2a9fdfdc8e0fdefac75.tar.gz
Fixed bug introduced in r577027 where the header frame of a message is directly passed to output handler where the channel is changed. This causing problems when the message is sent to multiple channels concurrently. I've added a const modifier to preventthe message being altered by sendHeader().
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@581185 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/broker/Message.cpp5
-rw-r--r--qpid/cpp/src/qpid/broker/Message.h4
-rw-r--r--qpid/cpp/src/qpid/framing/frame_functors.h17
3 files changed, 22 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/broker/Message.cpp b/qpid/cpp/src/qpid/broker/Message.cpp
index f0cbf027df..d03985b15f 100644
--- a/qpid/cpp/src/qpid/broker/Message.cpp
+++ b/qpid/cpp/src/qpid/broker/Message.cpp
@@ -173,9 +173,10 @@ void Message::sendContent(framing::FrameHandler& out, uint16_t maxFrameSize)
}
}
-void Message::sendHeader(framing::FrameHandler& out, uint16_t /*maxFrameSize*/)
+void Message::sendHeader(framing::FrameHandler& out, uint16_t /*maxFrameSize*/) const
{
- frames.map_if(out, TypeFilter(HEADER_BODY));
+ Relay f(out);
+ frames.map_if(f, TypeFilter(HEADER_BODY));
}
MessageAdapter& Message::getAdapter() const
diff --git a/qpid/cpp/src/qpid/broker/Message.h b/qpid/cpp/src/qpid/broker/Message.h
index c1dd2f28fa..dec74586db 100644
--- a/qpid/cpp/src/qpid/broker/Message.h
+++ b/qpid/cpp/src/qpid/broker/Message.h
@@ -115,7 +115,7 @@ public:
void releaseContent(MessageStore* store);
void sendContent(framing::FrameHandler& out, uint16_t maxFrameSize);
- void sendHeader(framing::FrameHandler& out, uint16_t maxFrameSize);
+ void sendHeader(framing::FrameHandler& out, uint16_t maxFrameSize) const;
bool isContentLoaded() const;
@@ -132,7 +132,7 @@ public:
static PublishAdapter PUBLISH;
MessageAdapter& getAdapter() const;
- bool isContentReleased() { return store; }
+ bool isContentReleased() const { return store; }
};
}}
diff --git a/qpid/cpp/src/qpid/framing/frame_functors.h b/qpid/cpp/src/qpid/framing/frame_functors.h
index ed664d1529..d5b1321d72 100644
--- a/qpid/cpp/src/qpid/framing/frame_functors.h
+++ b/qpid/cpp/src/qpid/framing/frame_functors.h
@@ -82,6 +82,23 @@ public:
void operator()(const AMQFrame& f) { content += f.castBody<AMQContentBody>()->getData(); }
};
+/**
+ * Sends a copy of the frame its applied to to the specified handler
+ */
+class Relay
+{
+ FrameHandler& handler;
+
+public:
+ Relay(FrameHandler& h) : handler(h) {}
+
+ void operator()(const AMQFrame& f)
+ {
+ AMQFrame copy(f);
+ handler.handle(copy);
+ }
+};
+
class Print
{
std::ostream& out;