Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (int)handleConnectAttempt:(int)socket addr:(const struct sockaddr *)addr addrlen:(socklen_t)addrlen {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- // if socket is non-blocking...
- BOOL wasNonBlocking = NO;
- if (((flags = fcntl(socket,F_GETFL)) != -1) && ((flags & O_NONBLOCK) != 0)){
- BOOL wasNonBlocking = YES;
- // make it blocking...
- }
- // run connect...
- int retval = connectReentry(socket, addr, addrlen);
- // swap file descriptors and such
- // fix socket to original condition
- if (wasNonBlocking) {
- // make it non-blocking again...
- }
- [pool drain];
- return retval;
- }
Add Comment
Please, Sign In to add comment