improve socket connect() error reporting with poll()
turns out that poll() may (and on linux does) signal POLLERR on connection failure. this is unlike select(), which is specified to signal write readiness in every case. consequently, check whether we are connecting before checking for POLLERR.
This commit is contained in:
parent
d1900941f4
commit
37a28d8133
10
src/socket.c
10
src/socket.c
|
@ -633,14 +633,14 @@ socket_fd_cb( int events, void *aux )
|
||||||
{
|
{
|
||||||
conn_t *conn = (conn_t *)aux;
|
conn_t *conn = (conn_t *)aux;
|
||||||
|
|
||||||
if (events & POLLERR) {
|
if (conn->state == SCK_CONNECTING) {
|
||||||
error( "Unidentified socket error from %s.\n", conn->name );
|
socket_connected( conn );
|
||||||
socket_fail( conn );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn->state == SCK_CONNECTING) {
|
if (events & POLLERR) {
|
||||||
socket_connected( conn );
|
error( "Unidentified socket error from %s.\n", conn->name );
|
||||||
|
socket_fail( conn );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user