Created
March 18, 2016 17:15
-
-
Save hansemannn/72686e454881efc285a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port | |
{ | |
// This gets called for sockets created via accepting, so return if the connected socket is NOT us | |
if (sock != socket) { | |
return; | |
} | |
internalState = SOCKET_CONNECTED; | |
dispatch_block_t eventBlock = ^{ | |
NSDictionary* event = [NSDictionary dictionaryWithObjectsAndKeys:self,@"socket",nil]; | |
[self _fireEventToListener:@"connected" withObject:event listener:connected thisObject:self]; | |
}; | |
if (connected != nil) { | |
#ifdef TI_USE_KROLL_THREAD | |
eventBlock(); | |
#else | |
TiThreadPerformOnMainThread(eventBlock, NO); | |
#endif | |
} else { | |
RELEASE_TO_NIL(eventBlock); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment