diff options
Diffstat (limited to 'cpp/src/qpid/client')
| -rw-r--r-- | cpp/src/qpid/client/ClientConnection.cpp | 16 | ||||
| -rw-r--r-- | cpp/src/qpid/client/Connection.h | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/client/Connector.cpp | 11 | ||||
| -rw-r--r-- | cpp/src/qpid/client/Connector.h | 2 |
4 files changed, 15 insertions, 18 deletions
diff --git a/cpp/src/qpid/client/ClientConnection.cpp b/cpp/src/qpid/client/ClientConnection.cpp index d6d03680c1..bddadb0800 100644 --- a/cpp/src/qpid/client/ClientConnection.cpp +++ b/cpp/src/qpid/client/ClientConnection.cpp @@ -133,25 +133,22 @@ void Connection::erase(ChannelId id) { channels.erase(id); } -void Connection::received(AMQFrame* frame){ - // FIXME aconway 2007-01-25: Mutex - ChannelId id = frame->getChannel(); +void Connection::received(AMQFrame& frame){ + ChannelId id = frame.getChannel(); Channel* channel = channels[id]; - // FIXME aconway 2007-01-26: Exception thrown here is hanging the - // client. Need to review use of exceptions. if (channel == 0) THROW_QPID_ERROR( PROTOCOL_ERROR+504, (boost::format("Invalid channel number %g") % id).str()); try{ - channel->handleBody(frame->getBody()); + channel->getHandlers().in->handle(frame); }catch(const qpid::QpidError& e){ channelException( - *channel, dynamic_cast<AMQMethodBody*>(frame->getBody().get()), e); + *channel, dynamic_cast<AMQMethodBody*>(frame.getBody().get()), e); } } -void Connection::send(AMQFrame* frame) { +void Connection::send(AMQFrame& frame) { out->send(frame); } @@ -172,7 +169,8 @@ void Connection::idleIn(){ } void Connection::idleOut(){ - out->send(new AMQFrame(version, 0, new AMQHeartbeatBody())); + AMQFrame frame(version, 0, new AMQHeartbeatBody()); + out->send(frame); } }} // namespace qpid::client diff --git a/cpp/src/qpid/client/Connection.h b/cpp/src/qpid/client/Connection.h index c3b9aa33d0..51434fcefd 100644 --- a/cpp/src/qpid/client/Connection.h +++ b/cpp/src/qpid/client/Connection.h @@ -159,8 +159,8 @@ class Connection : public ConnectionForChannel // TODO aconway 2007-01-26: can these be private? - void send(framing::AMQFrame*); - void received(framing::AMQFrame*); + void send(framing::AMQFrame&); + void received(framing::AMQFrame&); void idleOut(); void idleIn(); void shutdown(); diff --git a/cpp/src/qpid/client/Connector.cpp b/cpp/src/qpid/client/Connector.cpp index 17b68c1f6a..257e2b577a 100644 --- a/cpp/src/qpid/client/Connector.cpp +++ b/cpp/src/qpid/client/Connector.cpp @@ -22,6 +22,7 @@ #include "qpid/log/Statement.h" #include "qpid/QpidError.h" #include "qpid/sys/Time.h" +#include "qpid/framing/AMQFrame.h" #include "Connector.h" namespace qpid { @@ -91,11 +92,9 @@ OutputHandler* Connector::getOutputHandler(){ return this; } -void Connector::send(AMQFrame* f){ - std::auto_ptr<AMQFrame> frame(f); - AMQBody::shared_ptr body = frame->getBody(); - writeBlock(frame.get()); - QPID_LOG(trace, "SENT: " << *frame); +void Connector::send(AMQFrame& frame){ + writeBlock(&frame); + QPID_LOG(trace, "SENT: " << frame); } void Connector::writeBlock(AMQDataBlock* data){ @@ -185,7 +184,7 @@ void Connector::run(){ AMQFrame frame(version); while(frame.decode(inbuf)){ QPID_LOG(trace, "RECV: " << frame); - input->received(&frame); + input->received(frame); } //need to compact buffer to preserve any 'extra' data inbuf.compact(); diff --git a/cpp/src/qpid/client/Connector.h b/cpp/src/qpid/client/Connector.h index 9447a05a07..1577564d57 100644 --- a/cpp/src/qpid/client/Connector.h +++ b/cpp/src/qpid/client/Connector.h @@ -91,7 +91,7 @@ class Connector : public framing::OutputHandler, virtual void setTimeoutHandler(sys::TimeoutHandler* handler); virtual void setShutdownHandler(sys::ShutdownHandler* handler); virtual framing::OutputHandler* getOutputHandler(); - virtual void send(framing::AMQFrame* frame); + virtual void send(framing::AMQFrame& frame); virtual void setReadTimeout(uint16_t timeout); virtual void setWriteTimeout(uint16_t timeout); }; |
