diff options
Diffstat (limited to 'Swiften/StreamManagement/StanzaAckRequester.cpp')
-rw-r--r-- | Swiften/StreamManagement/StanzaAckRequester.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Swiften/StreamManagement/StanzaAckRequester.cpp b/Swiften/StreamManagement/StanzaAckRequester.cpp index 52ff6f0..8941f4a 100644 --- a/Swiften/StreamManagement/StanzaAckRequester.cpp +++ b/Swiften/StreamManagement/StanzaAckRequester.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,8 +7,8 @@ #include <Swiften/StreamManagement/StanzaAckRequester.h> #include <boost/numeric/conversion/cast.hpp> -#include <iostream> +#include <Swiften/Base/Log.h> #include <Swiften/Elements/Message.h> namespace Swift { @@ -19,26 +19,26 @@ StanzaAckRequester::StanzaAckRequester() : lastHandledStanzasCount(0) { } -void StanzaAckRequester::handleStanzaSent(boost::shared_ptr<Stanza> stanza) { - unackedStanzas.push_back(stanza); - if (boost::dynamic_pointer_cast<Message>(stanza)) { - onRequestAck(); - } +void StanzaAckRequester::handleStanzaSent(std::shared_ptr<Stanza> stanza) { + unackedStanzas.push_back(stanza); + if (std::dynamic_pointer_cast<Message>(stanza)) { + onRequestAck(); + } } void StanzaAckRequester::handleAckReceived(unsigned int handledStanzasCount) { - unsigned int i = lastHandledStanzasCount; - while (i != handledStanzasCount) { - if (unackedStanzas.empty()) { - std::cerr << "Warning: Server acked more stanzas than we sent" << std::endl; - break; - } - boost::shared_ptr<Stanza> ackedStanza = unackedStanzas.front(); - unackedStanzas.pop_front(); - onStanzaAcked(ackedStanza); - i = (i == MAX_HANDLED_STANZA_COUNT ? 0 : i + 1); - } - lastHandledStanzasCount = handledStanzasCount; + unsigned int i = lastHandledStanzasCount; + while (i != handledStanzasCount) { + if (unackedStanzas.empty()) { + SWIFT_LOG(warning) << "Server acked more stanzas than we sent" << std::endl; + break; + } + std::shared_ptr<Stanza> ackedStanza = unackedStanzas.front(); + unackedStanzas.pop_front(); + onStanzaAcked(ackedStanza); + i = (i == MAX_HANDLED_STANZA_COUNT ? 0 : i + 1); + } + lastHandledStanzasCount = handledStanzasCount; } } |