Ensure that real errors from connect() (eg. EINVAL) are detected and
acted on immmediately, even for nonblocking connects. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@175 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
[Changes 1.2c01]
|
[Changes 1.2c01]
|
||||||
|
|
||||||
|
* Improve connect() error handling. (caf)
|
||||||
|
|
||||||
* Remove obsolete .spec files. (caf)
|
* Remove obsolete .spec files. (caf)
|
||||||
|
|
||||||
* configure - only create sig.inc if it's actually needed. (caf)
|
* configure - only create sig.inc if it's actually needed. (caf)
|
||||||
|
|||||||
@@ -611,13 +611,10 @@ int BX_connect_by_number(char *hostn, unsigned short *portnum, int service, int
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
alarm(get_int_var(CONNECT_TIMEOUT_VAR));
|
alarm(get_int_var(CONNECT_TIMEOUT_VAR));
|
||||||
if (connect (fd, (struct sockaddr *)&server, sizeof(server)) < 0)
|
if (connect(fd, (struct sockaddr *)&server, sizeof(server)) < 0 && errno != EINPROGRESS)
|
||||||
{
|
{
|
||||||
alarm(0);
|
alarm(0);
|
||||||
#ifdef NON_BLOCKING_CONNECTS
|
return close(fd), -4;
|
||||||
if (!nonblocking)
|
|
||||||
#endif
|
|
||||||
return close(fd), -4;
|
|
||||||
}
|
}
|
||||||
alarm(0);
|
alarm(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user