diff options
| author | Gordon Sim <gsim@apache.org> | 2008-02-15 08:26:00 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2008-02-15 08:26:00 +0000 |
| commit | 4351730550bc48c4237de4e616f8e420e084c081 (patch) | |
| tree | f4d0101055d375a91e3838e0ee31651ff6e72122 /cpp/lib/client/ClientChannel.cpp | |
| parent | 4a5dd2bc8257c7a370088a179acc760b143c62a8 (diff) | |
| download | qpid-python-4351730550bc48c4237de4e616f8e420e084c081.tar.gz | |
* updated c++ build to work with recent gentools changes
* add null exchange.bound impl to SessionHandlerImpl (to reflect change to spec file)
* pass AMQDataBlocks rather than AMQFrames to OutputHandler
* allow client to pass messages frames to io layer in one go (via FrameList) if it will fit in a single buffer
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@627971 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/client/ClientChannel.cpp')
| -rw-r--r-- | cpp/lib/client/ClientChannel.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cpp/lib/client/ClientChannel.cpp b/cpp/lib/client/ClientChannel.cpp index a97d79dcf9..92f8ae63ca 100644 --- a/cpp/lib/client/ClientChannel.cpp +++ b/cpp/lib/client/ClientChannel.cpp @@ -23,6 +23,7 @@ #include <ClientMessage.h> #include <QpidError.h> #include <MethodBodyInstances.h> +#include <framing/FrameList.h> using namespace boost; //to use dynamic_pointer_cast using namespace qpid::client; @@ -219,19 +220,25 @@ void Channel::publish(Message& msg, const Exchange& exchange, const std::string& string e = exchange.getName(); string key = routingKey; - out->send(new AMQFrame(version, id, new BasicPublishBody(version, 0, e, key, mandatory, immediate))); + std::auto_ptr<FrameList> message(new FrameList()); + + message->add(new AMQFrame(version, id, new BasicPublishBody(version, 0, e, key, mandatory, immediate))); //break msg up into header frame and content frame(s) and send these string data = msg.getData(); msg.header->setContentSize(data.length()); AMQBody::shared_ptr body(static_pointer_cast<AMQBody, AMQHeaderBody>(msg.header)); - out->send(new AMQFrame(version, id, body)); + message->add(new AMQFrame(version, id, body)); u_int64_t data_length = data.length(); if(data_length > 0){ u_int32_t frag_size = con->getMaxFrameSize() - 8;//frame itself uses 8 bytes - if(data_length < frag_size){ - out->send(new AMQFrame(version, id, new AMQContentBody(data))); + if(data_length + message->size() < frag_size){ + message->add(new AMQFrame(version, id, new AMQContentBody(data))); + } else if(data_length < frag_size){ + out->send(message.release()); + out->send(new AMQFrame(version, id, new AMQContentBody(data))); }else{ + out->send(message.release()); u_int32_t offset = 0; u_int32_t remaining = data_length - offset; while (remaining > 0) { @@ -244,6 +251,7 @@ void Channel::publish(Message& msg, const Exchange& exchange, const std::string& } } } + if (message.get()) out->send(message.release()); } void Channel::commit(){ |
