From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | David Ford <david(at)blue-labs(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [patch] helps fe-connect.c handle -EINTR more gracefully |
Date: | 2001-10-26 14:46:23 |
Message-ID: | 23972.1004107583@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
David Ford <david(at)blue-labs(dot)org> writes:
> Please wait a day before applying the patch, I want to make it a bit
> more clean/readable and make sure I covered everything in fe-connect.c,
BTW, reading the HPUX man page for connect I find the following relevant
error codes:
[EALREADY] Nonblocking I/O is enabled with
O_NONBLOCK, O_NDELAY, or FIOSNBIO, and a
previous connection attempt has not yet
completed.
[EINPROGRESS] Nonblocking I/O is enabled using
O_NONBLOCK, O_NDELAY, or FIOSNBIO, and
the connection cannot be completed
immediately. This is not a failure.
Make the connect() call again a few
seconds later. Alternatively, wait for
completion by calling select() and
selecting for write.
[EINTR] The connect was interrupted by a signal
before the connect sequence was
complete. The building of the
connection still takes place, even
though the user is not blocked on the
connect() call.
[EISCONN] The socket is already connected.
This does not actually *say* that the appropriate behavior after EINTR
is to retry, but reading between the lines one might infer that it will
work like the nonblocking case, wherein a retry of connect tries to link
to the existing connection attempt, not start a new one.
What's more important is that a retry will expose the possibility of
getting EALREADY or EISCONN. EALREADY certainly must be treated as
success the same as EINPROGRESS (if it exists on a given platform ---
better #ifdef it I think). Not so sure about EISCONN; does that imply
"you moron, this socket's been open forever", or does it get returned on
the first iteration that doesn't return EALREADY?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2001-10-26 18:41:16 | Re: 7.2b1 ... |
Previous Message | Tom Lane | 2001-10-26 14:22:16 | Re: [patch] helps fe-connect.c handle -EINTR more gracefully |