fixed iOS closing sockets on open timeout
This commit is contained in:
		@@ -162,4 +162,5 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 - 1.5.0 - added iOS open and write timeouts, changed js errors format
 | 
			
		||||
 - 1.5.1 - fixed cordova js bridge implementation
 | 
			
		||||
 - 1.5.2 - fixed iOS open timeout
 | 
			
		||||
 - 1.5.3 - added Android open and write timeouts
 | 
			
		||||
 - 1.5.3 - added Android open and write timeouts
 | 
			
		||||
 - 1.5.4 - fixed iOS closing sockets on open timeout
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "cordova-plugin-socket-tcp",
 | 
			
		||||
  "version": "1.5.3",
 | 
			
		||||
  "version": "1.5.4",
 | 
			
		||||
  "description": "This Cordova plugin provides JavaScript API, that allows you to communicate with server through TCP protocol. Currently we support these platforms: iOS, Android, WP8.",
 | 
			
		||||
  "cordova": {
 | 
			
		||||
    "platforms": [
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
 | 
			
		||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-socket-tcp" version="1.5.3">
 | 
			
		||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-socket-tcp" version="1.5.4">
 | 
			
		||||
    <name>SocketsForCordova</name>
 | 
			
		||||
    <description>
 | 
			
		||||
		This Cordova plugin provides JavaScript API, that allows you to communicate with server through TCP protocol.
 | 
			
		||||
 
 | 
			
		||||
@@ -80,6 +80,7 @@ int writeTimeoutSeconds = 5.0;
 | 
			
		||||
    //self.errorEventHandler(@"Socket open timeout", @"openTimeout");
 | 
			
		||||
    self.openErrorEventHandler(@"Socket open timeout");
 | 
			
		||||
    openTimer = nil;
 | 
			
		||||
    [self close];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
-(void)onWriteTimeout:(NSTimer *)timer {
 | 
			
		||||
 
 | 
			
		||||
@@ -41,11 +41,10 @@
 | 
			
		||||
        socketAdapter = nil;
 | 
			
		||||
    };
 | 
			
		||||
    socketAdapter.openErrorEventHandler = ^ void (NSString *error){
 | 
			
		||||
        NSLog(@"[NATIVE] openErrorEventHandler");
 | 
			
		||||
        [self.commandDelegate
 | 
			
		||||
         sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error]
 | 
			
		||||
         callbackId:command.callbackId];
 | 
			
		||||
 | 
			
		||||
        socketAdapter = nil;
 | 
			
		||||
    };
 | 
			
		||||
    socketAdapter.errorEventHandler = ^ void (NSString *error, NSString *errorType){
 | 
			
		||||
        NSMutableDictionary *errorDictionaryData = [[NSMutableDictionary alloc] init];
 | 
			
		||||
@@ -65,6 +64,7 @@
 | 
			
		||||
        [self dispatchEventWithDictionary:dataDictionary];
 | 
			
		||||
    };
 | 
			
		||||
    socketAdapter.closeEventHandler = ^ void (BOOL hasErrors) {
 | 
			
		||||
        NSLog(@"[NATIVE] closeEventHandler");
 | 
			
		||||
        NSMutableDictionary *closeDictionaryData = [[NSMutableDictionary alloc] init];
 | 
			
		||||
        [closeDictionaryData setObject:@"Close" forKey:@"type"];
 | 
			
		||||
        [closeDictionaryData setObject:(hasErrors == TRUE ? @"true": @"false") forKey:@"hasError"];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user