Mercurial > ~mikael > mcabber > hg
comparison mcabber/connwrap/connwrap.c @ 431:89aeb8fdd215
Revert changeset 82064124324d22cacd25fc451c6c361ac4c4ac6b
This change does not work everywhere, and isn't needed anymore because we
now ignore SIGPIPE.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 11 Sep 2005 22:08:51 +0200 |
parents | ac85ce87f539 |
children | 40175f3dcef7 |
comparison
equal
deleted
inserted
replaced
430:d03663d2e7d9 | 431:89aeb8fdd215 |
---|---|
323 #endif | 323 #endif |
324 if ( !(*state & CW_CONNECT_WANT_SOMETHING)) | 324 if ( !(*state & CW_CONNECT_WANT_SOMETHING)) |
325 rc = connect(sockfd, serv_addr, addrlen); | 325 rc = connect(sockfd, serv_addr, addrlen); |
326 else{ /* check if the socket is connected correctly */ | 326 else{ /* check if the socket is connected correctly */ |
327 int optlen = sizeof(int), optval; | 327 int optlen = sizeof(int), optval; |
328 fd_set fds; | |
329 struct timeval tv; | |
330 | |
331 FD_ZERO(&fds); | |
332 FD_SET(sockfd, &fds); | |
333 | |
334 tv.tv_sec = 0; | |
335 tv.tv_usec = 10000; | |
336 | |
337 if (select(sockfd+1, 0, &fds, 0, &tv) < 1) | |
338 return -1; | |
339 if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, (socklen_t*)&optlen) || optval) | 328 if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, (socklen_t*)&optlen) || optval) |
340 return -1; | 329 return -1; |
341 *state = 0; | 330 *state = 0; |
342 return 0; | 331 return 0; |
343 } | 332 } |