summaryrefslogtreecommitdiffstats
blob: bfe6f4dd1de8ef1bf455e30a6f485290f6fd2137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * Copyright (c) 2010-2018 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#include <Swiften/StreamManagement/StanzaAckResponder.h>

namespace Swift {

static const unsigned int MAX_HANDLED_STANZA_COUNT = static_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);
}

}