Skip to content

Commit 5fdff65

Browse files
committed
Clarify comments to explain why we did the move
1 parent f7ccf33 commit 5fdff65

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Source/SocketIO/Engine/SocketEngine.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
359359
///
360360
/// **You shouldn't call this directly**
361361
open func doFastUpgrade() {
362-
363362
if waitingForPoll {
364363
DefaultSocketLogger.Logger.error("Outstanding poll when switched to WebSockets," +
365364
"we'll probably disconnect soon. You should report this.", type: SocketEngine.logType)
@@ -372,9 +371,10 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
372371
fastUpgrade = false
373372
probing = false
374373
flushProbeWait()
375-
374+
376375
// Need to flush postWait to socket since it connected successfully
377-
// (moved from flushProbeWait() since it is also called on connected failure)
376+
// moved from flushProbeWait() since it is also called on connected failure, and we don't want to try and send
377+
// packets through WebSockets when WebSockets has failed!
378378
if !postWait.isEmpty {
379379
flushWaitingForPostToWebSocket()
380380
}

Source/SocketIO/Manager/SocketManager.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,8 @@ open class SocketManager : NSObject, SocketManagerSpec, SocketParsable, SocketDa
168168
DefaultSocketLogger.Logger.log("Adding engine", type: SocketManager.logType)
169169

170170
engine?.engineQueue.sync {
171-
172171
self.engine?.client = nil
173-
172+
174173
// Close old engine so it will not leak because of URLSession if in polling mode
175174
self.engine?.disconnect(reason: "Adding new engine")
176175
}

0 commit comments

Comments
 (0)