Fixed loosing POST packets on web socket connection failure and engine memory leak on server errors.

This commit is contained in:
Erasov Ivan 2018-06-07 13:13:44 +03:00
parent d07441e7fa
commit b258a93750
2 changed files with 4 additions and 4 deletions

View File

@ -371,6 +371,9 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
fastUpgrade = false
probing = false
flushProbeWait()
if postWait.count != 0 {
flushWaitingForPostToWebSocket()
}
}
private func flushProbeWait() {
@ -381,10 +384,6 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
}
probeWait.removeAll(keepingCapacity: false)
if postWait.count != 0 {
flushWaitingForPostToWebSocket()
}
}
/// Causes any packets that were waiting for POSTing to be sent through the WebSocket. This happens because when

View File

@ -169,6 +169,7 @@ open class SocketManager : NSObject, SocketManagerSpec, SocketParsable, SocketDa
engine?.engineQueue.sync {
self.engine?.client = nil
self.engine?.disconnect(reason: "Adding new engine")
}
engine = SocketEngine(client: self, url: socketURL, config: config)