Added comments to document changes reasons
This commit is contained in:
parent
b258a93750
commit
feb476c76b
@ -359,6 +359,7 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
|
|||||||
///
|
///
|
||||||
/// **You shouldn't call this directly**
|
/// **You shouldn't call this directly**
|
||||||
open func doFastUpgrade() {
|
open func doFastUpgrade() {
|
||||||
|
|
||||||
if waitingForPoll {
|
if waitingForPoll {
|
||||||
DefaultSocketLogger.Logger.error("Outstanding poll when switched to WebSockets," +
|
DefaultSocketLogger.Logger.error("Outstanding poll when switched to WebSockets," +
|
||||||
"we'll probably disconnect soon. You should report this.", type: SocketEngine.logType)
|
"we'll probably disconnect soon. You should report this.", type: SocketEngine.logType)
|
||||||
@ -371,7 +372,10 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
|
|||||||
fastUpgrade = false
|
fastUpgrade = false
|
||||||
probing = false
|
probing = false
|
||||||
flushProbeWait()
|
flushProbeWait()
|
||||||
if postWait.count != 0 {
|
|
||||||
|
// Need to flush postWait to socket since it connected successfully
|
||||||
|
// (moved from flushProbeWait() since it is also called on connected failure)
|
||||||
|
if !postWait.isEmpty {
|
||||||
flushWaitingForPostToWebSocket()
|
flushWaitingForPostToWebSocket()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -168,7 +168,10 @@ open class SocketManager : NSObject, SocketManagerSpec, SocketParsable, SocketDa
|
|||||||
DefaultSocketLogger.Logger.log("Adding engine", type: SocketManager.logType)
|
DefaultSocketLogger.Logger.log("Adding engine", type: SocketManager.logType)
|
||||||
|
|
||||||
engine?.engineQueue.sync {
|
engine?.engineQueue.sync {
|
||||||
|
|
||||||
self.engine?.client = nil
|
self.engine?.client = nil
|
||||||
|
|
||||||
|
// Close old engine so it will not leak because of URLSession if in polling mode
|
||||||
self.engine?.disconnect(reason: "Adding new engine")
|
self.engine?.disconnect(reason: "Adding new engine")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user