summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/Connector.cpp')
-rw-r--r--Swiften/Network/Connector.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp
index e86b327..5eddaba 100644
--- a/Swiften/Network/Connector.cpp
+++ b/Swiften/Network/Connector.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -148,6 +148,13 @@ void Connector::handleConnectionConnectFinished(bool error) {
148 timer->stop(); 148 timer->stop();
149 timer.reset(); 149 timer.reset();
150 } 150 }
151 if (!currentConnection) {
152 // We've hit a race condition where multiple finisheds were on the eventloop queue at once.
153 // This is particularly likely on macOS where the hourly momentary wakeup while asleep
154 // can cause both a timeout and an onConnectFinished to be queued sequentially (SWIFT-232).
155 // Let the first one process as normal, but ignore the second.
156 return;
157 }
151 currentConnection->onConnectFinished.disconnect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1)); 158 currentConnection->onConnectFinished.disconnect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1));
152 if (error) { 159 if (error) {
153 currentConnection.reset(); 160 currentConnection.reset();