isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 37a28d81333ce1295d9634e8211c6b3d05ac0dc9
parent d1900941f4068de406a211c95989bb7c9b272420
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Fri, 29 Mar 2013 18:11:57 +0100

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.

Diffstat:
Msrc/socket.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/socket.c b/src/socket.c @@ -633,14 +633,14 @@ socket_fd_cb( int events, void *aux ) { conn_t *conn = (conn_t *)aux; - if (events & POLLERR) { - error( "Unidentified socket error from %s.\n", conn->name ); - socket_fail( conn ); + if (conn->state == SCK_CONNECTING) { + socket_connected( conn ); return; } - if (conn->state == SCK_CONNECTING) { - socket_connected( conn ); + if (events & POLLERR) { + error( "Unidentified socket error from %s.\n", conn->name ); + socket_fail( conn ); return; }