SocketIOClient: added assertion to check timeoutAfter is not negative

This commit is contained in:
NachoSoto 2015-09-11 05:28:28 +00:00
parent 40d76cdbeb
commit 1739afa670

View File

@ -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)
} }