summaryrefslogtreecommitdiff
path: root/cpp/lib/common
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2007-02-13 21:52:30 +0000
committerAndrew Stitcher <astitcher@apache.org>2007-02-13 21:52:30 +0000
commit5d8e8d39e1e5e13d0753c53a8095f075895d01a1 (patch)
tree727d30e03ae1679827779560a32f11c12f32d4a5 /cpp/lib/common
parent9517deedff9691dbe3429b0b917dfd4208b0b1b8 (diff)
downloadqpid-python-5d8e8d39e1e5e13d0753c53a8095f075895d01a1.tar.gz
r1111@fuschia: andrew | 2007-02-09 15:51:10 +0000
Removed currently unused request tracking logic r1125@fuschia: andrew | 2007-02-13 21:51:30 +0000 Implemented receiveing batched Message.ok in c++ broker Implemented batched response frames in python client code git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@507249 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/common')
-rw-r--r--cpp/lib/common/framing/ChannelAdapter.cpp3
-rw-r--r--cpp/lib/common/framing/ChannelAdapter.h4
-rw-r--r--cpp/lib/common/framing/Requester.cpp15
-rw-r--r--cpp/lib/common/framing/Requester.h9
4 files changed, 11 insertions, 20 deletions
diff --git a/cpp/lib/common/framing/ChannelAdapter.cpp b/cpp/lib/common/framing/ChannelAdapter.cpp
index 40241660f2..8a1ff39ee5 100644
--- a/cpp/lib/common/framing/ChannelAdapter.cpp
+++ b/cpp/lib/common/framing/ChannelAdapter.cpp
@@ -61,7 +61,6 @@ void ChannelAdapter::handleRequest(AMQRequestBody::shared_ptr request) {
assertMethodOk(*request);
AMQRequestBody::Data& requestData = request->getData();
responder.received(requestData);
- requestInProgress = requestData.requestId;
handleMethodInContext(request, MethodContext(this, request));
}
@@ -71,8 +70,6 @@ void ChannelAdapter::handleResponse(AMQResponseBody::shared_ptr response) {
// Review - any cases where this is not the case?
AMQResponseBody::Data& responseData = response->getData();
requester.processed(responseData);
- // For a response this is taken to be the request being responded to (for convenience)
- requestInProgress = responseData.requestId;
handleMethod(response);
}
diff --git a/cpp/lib/common/framing/ChannelAdapter.h b/cpp/lib/common/framing/ChannelAdapter.h
index 9f654d9a5b..36362a417a 100644
--- a/cpp/lib/common/framing/ChannelAdapter.h
+++ b/cpp/lib/common/framing/ChannelAdapter.h
@@ -85,7 +85,8 @@ class ChannelAdapter : public BodyHandler {
boost::shared_ptr<qpid::framing::AMQMethodBody> method,
const MethodContext& context) = 0;
- RequestId getRequestInProgress() { return requestInProgress; }
+ RequestId getFirstAckRequest() { return requester.getFirstAckRequest(); }
+ RequestId getLastAckRequest() { return requester.getLastAckRequest(); }
RequestId getNextSendRequestId() { return requester.getNextId(); }
private:
@@ -94,7 +95,6 @@ class ChannelAdapter : public BodyHandler {
ProtocolVersion version;
Requester requester;
Responder responder;
- RequestId requestInProgress;
};
}}
diff --git a/cpp/lib/common/framing/Requester.cpp b/cpp/lib/common/framing/Requester.cpp
index 37b2d37c86..9ee809e2ee 100644
--- a/cpp/lib/common/framing/Requester.cpp
+++ b/cpp/lib/common/framing/Requester.cpp
@@ -29,23 +29,12 @@ Requester::Requester() : lastId(0), responseMark(0) {}
void Requester::sending(AMQRequestBody::Data& request) {
request.requestId = ++lastId;
request.responseMark = responseMark;
- requests.insert(request.requestId);
}
void Requester::processed(const AMQResponseBody::Data& response) {
responseMark = response.responseId;
- RequestId id = response.requestId;
- RequestId end = id + response.batchOffset + 1;
- for ( ; id < end; ++id) {
- std::set<RequestId>::iterator i = requests.find(id);
- if (i != requests.end())
- requests.erase(i);
- else {
- THROW_QPID_ERROR(
- PROTOCOL_ERROR,
- boost::format("Response with non-existent request id=%d")%id);
- }
- }
+ firstAckRequest = response.requestId;
+ lastAckRequest = firstAckRequest + response.batchOffset;
}
}} // namespace qpid::framing
diff --git a/cpp/lib/common/framing/Requester.h b/cpp/lib/common/framing/Requester.h
index dae5b1eaee..dcc4460041 100644
--- a/cpp/lib/common/framing/Requester.h
+++ b/cpp/lib/common/framing/Requester.h
@@ -46,13 +46,18 @@ class Requester
/** Called after processing a response. */
void processed(const AMQResponseBody::Data&);
- /** Get the next id to be used. */
+ /** Get the next request id to be used. */
RequestId getNextId() { return lastId + 1; }
+ /** Get the first request acked by this response */
+ RequestId getFirstAckRequest() { return firstAckRequest; }
+ /** Get the last request acked by this response */
+ RequestId getLastAckRequest() { return lastAckRequest; }
private:
- std::set<RequestId> requests; /** Sent but not responded to */
RequestId lastId;
ResponseId responseMark;
+ ResponseId firstAckRequest;
+ ResponseId lastAckRequest;
};
}} // namespace qpid::framing