From ef1469a7ea1f54f266aee8f2899b7cd0c7e07d08 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 15 Jan 2007 21:56:23 +0000 Subject: * Client & broker using Requester/Responder to manage request/response IDs. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@496511 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/lib/client/Connection.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'cpp/lib/client/Connection.cpp') diff --git a/cpp/lib/client/Connection.cpp b/cpp/lib/client/Connection.cpp index ad8aa1d0dd..10a0b50aad 100644 --- a/cpp/lib/client/Connection.cpp +++ b/cpp/lib/client/Connection.cpp @@ -32,10 +32,14 @@ using namespace qpid::sys; u_int16_t Connection::channelIdCounter; -Connection::Connection( bool debug, u_int32_t _max_frame_size, qpid::framing::ProtocolVersion* _version) : max_frame_size(_max_frame_size), closed(true), +Connection::Connection( + bool debug, u_int32_t _max_frame_size, + qpid::framing::ProtocolVersion* _version +) : max_frame_size(_max_frame_size), closed(true), version(_version->getMajor(),_version->getMinor()) { - connector = new Connector(version, debug, _max_frame_size); + connector = new Connector( + version, requester, responder, debug, _max_frame_size); } Connection::~Connection(){ @@ -152,6 +156,16 @@ void Connection::removeChannel(Channel* channel){ } void Connection::received(AMQFrame* frame){ + AMQBody::shared_ptr body = frame->getBody(); + u_int8_t type = body->type(); + if (type == REQUEST_BODY) + responder.received(AMQRequestBody::getData(body)); + handleFrame(frame); + if (type == RESPONSE_BODY) + requester.processed(AMQResponseBody::getData(body)); +} + +void Connection::handleFrame(AMQFrame* frame){ u_int16_t channelId = frame->getChannel(); if(channelId == 0){ -- cgit v1.2.1