From 7719285010a366909422878d7bcabc9b01f79575 Mon Sep 17 00:00:00 2001 From: aaa Date: Mon, 13 Oct 2014 10:18:30 +0100 Subject: [PATCH] Fix of crash when network is unreachable during connecting --- src/ios/SocketsForCordova/Classes/SocketAdapter.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ios/SocketsForCordova/Classes/SocketAdapter.m b/src/ios/SocketsForCordova/Classes/SocketAdapter.m index dbe9f0e..761bd06 100644 --- a/src/ios/SocketsForCordova/Classes/SocketAdapter.m +++ b/src/ios/SocketsForCordova/Classes/SocketAdapter.m @@ -152,17 +152,17 @@ BOOL wasOpenned = FALSE; case NSStreamEventErrorOccurred: { NSLog(@"Stream event error: %@", [[stream streamError] localizedDescription]); - + + [self close]; + if (wasOpenned) { self.errorEventHandler([[stream streamError] localizedDescription]); self.closeEventHandler(TRUE); } else { - self.openErrorEventHandler([[stream streamError] localizedDescription]); self.errorEventHandler([[stream streamError] localizedDescription]); + self.openErrorEventHandler([[stream streamError] localizedDescription]); } - - [self close]; break; } default: {