From: Marko Kreen Date: Fri, 4 Jan 2008 09:12:54 +0000 (+0000) Subject: handle EINTR from connect() X-Git-Tag: pgbouncer_1_2_rc2~92 X-Git-Url: http://git.postgresql.org/gitweb/static/session/%7B%7Bsession.id%7D%7D-%7B%7Bsession.title%7Cslugify%7D%7D?a=commitdiff_plain;h=5708ec7d98e26bb7f57cc1c50eb056848cfb7702;p=pgbouncer.git handle EINTR from connect() --- diff --git a/src/sbuf.c b/src/sbuf.c index 7b66739..da7198c 100644 --- a/src/sbuf.c +++ b/src/sbuf.c @@ -153,18 +153,21 @@ bool sbuf_connect(SBuf *sbuf, const PgAddr *addr, const char *unix_dir, int time timeout.tv_usec = 0; /* launch connection */ +loop: res = connect(sock, sa, len); log_noise("connect(%d)=%d", sock, res); if (res == 0) { /* unix socket gives connection immidiately */ sbuf_connect_cb(sock, EV_WRITE, sbuf); return true; - } else if (res < 0 && errno == EINPROGRESS) { + } else if (errno == EINPROGRESS) { /* tcp socket needs waiting */ event_set(&sbuf->ev, sock, EV_WRITE, sbuf_connect_cb, sbuf); res = event_add(&sbuf->ev, &timeout); if (res >= 0) return true; + } else if (errno == EINTR) { + goto loop; } failed: