|
@@ -389,7 +389,16 @@ static __strong NSData *CRLFCRLF;
|
|
NSAssert(_readyState == SR_CONNECTING, @"Cannot call -(void)open on SRWebSocket more than once");
|
|
NSAssert(_readyState == SR_CONNECTING, @"Cannot call -(void)open on SRWebSocket more than once");
|
|
|
|
|
|
_selfRetain = self;
|
|
_selfRetain = self;
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ if (_urlRequest.timeoutInterval > 0)
|
|
|
|
+ {
|
|
|
|
+ dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, _urlRequest.timeoutInterval * NSEC_PER_SEC);
|
|
|
|
+ dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
|
|
|
+ if (self.readyState == SR_CONNECTING)
|
|
|
|
+ [self _failWithError:[NSError errorWithDomain:@"com.squareup.SocketRocket" code:60 userInfo:@{NSLocalizedDescriptionKey: @"Timeout Connecting to Server"}]];
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
[self openConnection];
|
|
[self openConnection];
|
|
}
|
|
}
|
|
|
|
|