diff --git a/SocketRocket/SRWebSocket.m b/SocketRocket/SRWebSocket.m index 175b5dfbb..0330482b6 100644 --- a/SocketRocket/SRWebSocket.m +++ b/SocketRocket/SRWebSocket.m @@ -182,13 +182,11 @@ - (void)_writeData:(NSData *)data; - (void)_closeWithProtocolError:(NSString *)message; - (void)_failWithError:(NSError *)error; -- (void)_disconnect; - (void)_readFrameNew; - (void)_readFrameContinue; - (void)_pumpScanner; - - (void)_pumpWriting; - (void)_addConsumerWithScanner:(stream_scanner)consumer callback:(data_callback)callback; @@ -203,7 +201,9 @@ - (BOOL)_checkHandshake:(CFHTTPMessageRef)httpMessage; - (void)_SR_commonInit; - (void)_initializeStreams; -- (void)_connect; + +- (void)disconnect; +- (void)connect; @property (nonatomic) SRReadyState readyState; @@ -399,7 +399,7 @@ - (void)open; _selfRetain = self; - [self _connect]; + [self connect]; } // Calls block on delegate queue @@ -588,7 +588,7 @@ - (void)_initializeStreams; _outputStream.delegate = self; } -- (void)_connect; +- (void)connect; { if (!_scheduledRunloops.count) { [self scheduleInRunLoop:[NSRunLoop SR_networkRunLoop] forMode:NSDefaultRunLoopMode]; @@ -635,7 +635,7 @@ - (void)closeWithCode:(NSInteger)code reason:(NSString *)reason; SRFastLog(@"Closing with code %d reason %@", code, reason); if (wasConnecting) { - [self _disconnect]; + [self disconnect]; return; } @@ -672,7 +672,7 @@ - (void)_closeWithProtocolError:(NSString *)message; [self _performDelegateBlock:^{ [self closeWithCode:SRStatusCodeProtocolError reason:message]; dispatch_async(_workQueue, ^{ - [self _disconnect]; + [self disconnect]; }); }]; } @@ -693,7 +693,7 @@ - (void)_failWithError:(NSError *)error; SRFastLog(@"Failing with error %@", error.localizedDescription); - [self _disconnect]; + [self disconnect]; } }); } @@ -835,11 +835,11 @@ - (void)handleCloseWithData:(NSData *)data; [self closeWithCode:1000 reason:nil]; } dispatch_async(_workQueue, ^{ - [self _disconnect]; + [self disconnect]; }); } -- (void)_disconnect; +- (void)disconnect; { [self assertOnWorkQueue]; SRFastLog(@"Trying to disconnect"); @@ -866,7 +866,7 @@ - (void)_handleFrameWithData:(NSData *)frameData opCode:(NSInteger)opcode; if (str == nil && frameData) { [self closeWithCode:SRStatusCodeInvalidUTF8 reason:@"Text frames must be valid UTF-8"]; dispatch_async(_workQueue, ^{ - [self _disconnect]; + [self disconnect]; }); return; @@ -1257,7 +1257,7 @@ - (BOOL)_innerPumpScanner { if (valid_utf8_size == -1) { [self closeWithCode:SRStatusCodeInvalidUTF8 reason:@"Text frames must be valid UTF-8"]; dispatch_async(_workQueue, ^{ - [self _disconnect]; + [self disconnect]; }); return didWork; } else {