fixed iOS closing sockets on open timeout
This commit is contained in:
		@@ -163,3 +163,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			|||||||
 - 1.5.1 - fixed cordova js bridge implementation
 | 
					 - 1.5.1 - fixed cordova js bridge implementation
 | 
				
			||||||
 - 1.5.2 - fixed iOS open timeout
 | 
					 - 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",
 | 
					  "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.",
 | 
					  "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": {
 | 
					  "cordova": {
 | 
				
			||||||
    "platforms": [
 | 
					    "platforms": [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?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>
 | 
					    <name>SocketsForCordova</name>
 | 
				
			||||||
    <description>
 | 
					    <description>
 | 
				
			||||||
		This Cordova plugin provides JavaScript API, that allows you to communicate with server through TCP protocol.
 | 
							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.errorEventHandler(@"Socket open timeout", @"openTimeout");
 | 
				
			||||||
    self.openErrorEventHandler(@"Socket open timeout");
 | 
					    self.openErrorEventHandler(@"Socket open timeout");
 | 
				
			||||||
    openTimer = nil;
 | 
					    openTimer = nil;
 | 
				
			||||||
 | 
					    [self close];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-(void)onWriteTimeout:(NSTimer *)timer {
 | 
					-(void)onWriteTimeout:(NSTimer *)timer {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,11 +41,10 @@
 | 
				
			|||||||
        socketAdapter = nil;
 | 
					        socketAdapter = nil;
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    socketAdapter.openErrorEventHandler = ^ void (NSString *error){
 | 
					    socketAdapter.openErrorEventHandler = ^ void (NSString *error){
 | 
				
			||||||
 | 
					        NSLog(@"[NATIVE] openErrorEventHandler");
 | 
				
			||||||
        [self.commandDelegate
 | 
					        [self.commandDelegate
 | 
				
			||||||
         sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error]
 | 
					         sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error]
 | 
				
			||||||
         callbackId:command.callbackId];
 | 
					         callbackId:command.callbackId];
 | 
				
			||||||
 | 
					 | 
				
			||||||
        socketAdapter = nil;
 | 
					 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    socketAdapter.errorEventHandler = ^ void (NSString *error, NSString *errorType){
 | 
					    socketAdapter.errorEventHandler = ^ void (NSString *error, NSString *errorType){
 | 
				
			||||||
        NSMutableDictionary *errorDictionaryData = [[NSMutableDictionary alloc] init];
 | 
					        NSMutableDictionary *errorDictionaryData = [[NSMutableDictionary alloc] init];
 | 
				
			||||||
@@ -65,6 +64,7 @@
 | 
				
			|||||||
        [self dispatchEventWithDictionary:dataDictionary];
 | 
					        [self dispatchEventWithDictionary:dataDictionary];
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    socketAdapter.closeEventHandler = ^ void (BOOL hasErrors) {
 | 
					    socketAdapter.closeEventHandler = ^ void (BOOL hasErrors) {
 | 
				
			||||||
 | 
					        NSLog(@"[NATIVE] closeEventHandler");
 | 
				
			||||||
        NSMutableDictionary *closeDictionaryData = [[NSMutableDictionary alloc] init];
 | 
					        NSMutableDictionary *closeDictionaryData = [[NSMutableDictionary alloc] init];
 | 
				
			||||||
        [closeDictionaryData setObject:@"Close" forKey:@"type"];
 | 
					        [closeDictionaryData setObject:@"Close" forKey:@"type"];
 | 
				
			||||||
        [closeDictionaryData setObject:(hasErrors == TRUE ? @"true": @"false") forKey:@"hasError"];
 | 
					        [closeDictionaryData setObject:(hasErrors == TRUE ? @"true": @"false") forKey:@"hasError"];
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user