From a28ea01f0e8925a14af69b7579f76ab250d3e104 Mon Sep 17 00:00:00 2001 From: Marcin Gibula Date: Thu, 8 Jun 2017 22:57:29 +0200 Subject: [PATCH] Call ACK and NACK callbacks --- src/basicackframe.h | 20 ++++++++++++++++++++ src/basicnackframe.h | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/basicackframe.h b/src/basicackframe.h index 1f3c577..9d10e13 100644 --- a/src/basicackframe.h +++ b/src/basicackframe.h @@ -110,6 +110,26 @@ public: { return _multiple.get(0); } + + /** + * Process the frame + * @param connection The connection over which it was received + * @return bool Was it succesfully processed? + */ + virtual bool process(ConnectionImpl *connection) override + { + // we need the appropriate channel + auto channel = connection->channel(this->channel()); + + // channel does not exist + if(!channel) return false; + + // start message counter + channel->reportAck(deliveryTag(), multiple()); + + // done + return true; + } }; /** diff --git a/src/basicnackframe.h b/src/basicnackframe.h index 89344fe..f6e5fc1 100644 --- a/src/basicnackframe.h +++ b/src/basicnackframe.h @@ -108,6 +108,26 @@ public: { return _bits.get(1); } + + /** + * Process the frame + * @param connection The connection over which it was received + * @return bool Was it succesfully processed? + */ + virtual bool process(ConnectionImpl *connection) override + { + // we need the appropriate channel + auto channel = connection->channel(this->channel()); + + // channel does not exist + if(!channel) return false; + + // start message counter + channel->reportNack(deliveryTag(), multiple(), requeue()); + + // done + return true; + } }; /**