Guest User

Untitled

a guest
Jun 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. - (int)handleConnectAttempt:(int)socket addr:(const struct sockaddr *)addr addrlen:(socklen_t)addrlen {
  2. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  3. // if socket is non-blocking...
  4. BOOL wasNonBlocking = NO;
  5. if (((flags = fcntl(socket,F_GETFL)) != -1) && ((flags & O_NONBLOCK) != 0)){
  6. BOOL wasNonBlocking = YES;
  7. // make it blocking...
  8. }
  9. // run connect...
  10. int retval = connectReentry(socket, addr, addrlen);
  11.  
  12. // swap file descriptors and such
  13.  
  14. // fix socket to original condition
  15. if (wasNonBlocking) {
  16. // make it non-blocking again...
  17. }
  18. [pool drain];
  19. return retval;
  20. }
Add Comment
Please, Sign In to add comment