SocketIOClient: added assertion to check timeoutAfter is not negative
This commit is contained in:
parent
40d76cdbeb
commit
1739afa670
@ -150,10 +150,13 @@ public final class SocketIOClient: NSObject, SocketEngineClient {
|
|||||||
*/
|
*/
|
||||||
public func connect(timeoutAfter timeoutAfter:Int,
|
public func connect(timeoutAfter timeoutAfter:Int,
|
||||||
withTimeoutHandler handler:(() -> Void)?) {
|
withTimeoutHandler handler:(() -> Void)?) {
|
||||||
guard status != SocketIOClientStatus.Connected else {
|
assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)")
|
||||||
|
|
||||||
|
guard status != .Connected else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if status == SocketIOClientStatus.Closed {
|
|
||||||
|
if status == .Closed {
|
||||||
Logger.log("Warning! This socket was previously closed. This might be dangerous!",
|
Logger.log("Warning! This socket was previously closed. This might be dangerous!",
|
||||||
type: logType)
|
type: logType)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user