diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-08-29 12:51:45 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-08-29 13:30:18 (GMT) |
commit | 0091fcc571758791442f82ece2a72444b6fe79cf (patch) | |
tree | 807f20a4047604a87f56d247d8ad7180489fe82b /Swiften/StreamManagement/StanzaAckResponder.cpp | |
parent | 901f620b6ccabde19ef460368028fa0464aa56c5 (diff) | |
download | swift-contrib-0091fcc571758791442f82ece2a72444b6fe79cf.zip swift-contrib-0091fcc571758791442f82ece2a72444b6fe79cf.tar.bz2 |
Added Stanza Ack Requester & Responder.
Diffstat (limited to 'Swiften/StreamManagement/StanzaAckResponder.cpp')
-rw-r--r-- | Swiften/StreamManagement/StanzaAckResponder.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Swiften/StreamManagement/StanzaAckResponder.cpp b/Swiften/StreamManagement/StanzaAckResponder.cpp new file mode 100644 index 0000000..05ab5c4 --- /dev/null +++ b/Swiften/StreamManagement/StanzaAckResponder.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "Swiften/StreamManagement/StanzaAckResponder.h" + +#include <boost/numeric/conversion/cast.hpp> + +namespace Swift { + +static const unsigned int MAX_HANDLED_STANZA_COUNT = boost::numeric_cast<unsigned int>((1ULL<<32) - 1); + +StanzaAckResponder::StanzaAckResponder() : handledStanzasCount(0) { +} + +void StanzaAckResponder::handleStanzaReceived() { + handledStanzasCount = (handledStanzasCount == MAX_HANDLED_STANZA_COUNT ? 0 : handledStanzasCount + 1); +} + +void StanzaAckResponder::handleAckRequestReceived() { + onAck(handledStanzasCount);} +} |