From 0db1af31320aa010c8e97da80000f7548d889068 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Mon, 23 Jul 2007 12:29:17 +0000 Subject: Added initial 'execution-layer' to try out methods form the 0-10 execution class. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@558700 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/SemanticHandler.cpp | 35 ++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'cpp/src/qpid/broker/SemanticHandler.cpp') diff --git a/cpp/src/qpid/broker/SemanticHandler.cpp b/cpp/src/qpid/broker/SemanticHandler.cpp index a96a8c5cde..f616ec2db8 100644 --- a/cpp/src/qpid/broker/SemanticHandler.cpp +++ b/cpp/src/qpid/broker/SemanticHandler.cpp @@ -36,7 +36,7 @@ SemanticHandler::SemanticHandler(ChannelId id, Connection& c) : void SemanticHandler::handle(framing::AMQFrame& frame) -{ +{ //TODO: assembly etc when move to 0-10 framing // //have potentially three separate tracks at this point: @@ -56,15 +56,40 @@ void SemanticHandler::handle(framing::AMQFrame& frame) //if ready to execute (i.e. if segment is complete or frame is //message content): handleBody(frame.getBody()); - //if the frameset is complete, we can move the execution-mark - //forward (not for execution controls) - //note: need to be more sophisticated than this if we execute - //commands that arrive within an active message frameset } //ChannelAdapter virtual methods: void SemanticHandler::handleMethodInContext(boost::shared_ptr method, const qpid::framing::MethodContext& context) +{ + if (!method->invoke(this)) { + //else do the usual: + handleL4(method, context); + //(if the frameset is complete) we can move the execution-mark + //forward + ++(incoming.hwm); + + //note: need to be more sophisticated than this if we execute + //commands that arrive within an active message frameset (that + //can't happen until 0-10 framing is implemented) + } +} + +void SemanticHandler::complete(u_int32_t mark) +{ + //just record it for now (will eventually need to use it to ack messages): + outgoing.lwm = SequenceNumber(mark); +} + +void SemanticHandler::flush() +{ + //flush doubles as a sync to begin with - send an execution.complete + incoming.lwm = incoming.hwm; + send(make_shared_ptr(new ExecutionCompleteBody(getVersion(), incoming.hwm.getValue()))); +} + +void SemanticHandler::handleL4(boost::shared_ptr method, + const qpid::framing::MethodContext& context) { try{ if(getId() != 0 && !method->isA() && !isOpen()) { -- cgit v1.2.1