summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/ClientSession.cpp')
-rw-r--r--Swiften/Client/ClientSession.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index 551d835..daffbc6 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -48,6 +48,7 @@ ClientSession::ClientSession(
allowPLAINOverNonTLS(false),
needSessionStart(false),
needResourceBind(false),
+ needAcking(false),
authenticator(NULL) {
}
@@ -213,13 +214,8 @@ void ClientSession::handleElement(boost::shared_ptr<Element> element) {
stream->setWhitespacePingEnabled(true);
needSessionStart = streamFeatures->hasSession();
needResourceBind = streamFeatures->hasResourceBind();
- if (streamFeatures->hasStreamManagement()) {
- state = EnablingSessionManagement;
- stream->writeElement(boost::shared_ptr<EnableStreamManagement>(new EnableStreamManagement()));
- }
- else {
- continueSessionInitialization();
- }
+ needAcking = streamFeatures->hasStreamManagement();
+ continueSessionInitialization();
}
}
else if (boost::dynamic_pointer_cast<Compressed>(element)) {
@@ -238,9 +234,11 @@ void ClientSession::handleElement(boost::shared_ptr<Element> element) {
stanzaAckRequester_->onStanzaAcked.connect(boost::bind(&ClientSession::handleStanzaAcked, this, _1));
stanzaAckResponder_ = boost::shared_ptr<StanzaAckResponder>(new StanzaAckResponder());
stanzaAckResponder_->onAck.connect(boost::bind(&ClientSession::ack, this, _1));
+ needAcking = false;
continueSessionInitialization();
}
else if (boost::dynamic_pointer_cast<StreamManagementFailed>(element)) {
+ needAcking = false;
continueSessionInitialization();
}
else if (AuthChallenge* challenge = dynamic_cast<AuthChallenge*>(element.get())) {
@@ -295,6 +293,10 @@ void ClientSession::continueSessionInitialization() {
}
sendStanza(IQ::createRequest(IQ::Set, JID(), "session-bind", resourceBind));
}
+ else if (needAcking) {
+ state = EnablingSessionManagement;
+ stream->writeElement(boost::shared_ptr<EnableStreamManagement>(new EnableStreamManagement()));
+ }
else if (needSessionStart) {
state = StartingSession;
sendStanza(IQ::createRequest(IQ::Set, JID(), "session-start", boost::shared_ptr<StartSession>(new StartSession())));