|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Brent Verner (brent
rcfile.org)Date: Wed Mar 07 2001 - 19:54:43 CST
On 07 Mar 2001 at 16:20 (-0500), Wietse Venema wrote:
| Several parts of Postfix do: connect() write() close(), where the
| close() may happen before the server has accept()ed the connection.
I see places (src/util/unix_connect.c:117) where postfix does
connect() on a non-blocking fd, tests for errno == EINPROGRESS,
then immediately returns the sockfd. I was under the impression
that when errno == EINPROGRESS, you should select()/poll() to
verify that the socket becomes writable, but I do not see where
a check for socket writability is being done before write() is
called. there is a write_wait(int,int) in postfix which looks
like it (c|sh)ould be used after connect() says EINPROGRESS
before writing.
brent
FBSD connect(2):
[EINPROGRESS] The socket is non-blocking and the connection cannot
be completed immediately. It is possible to select(2)
for completion by selecting the socket for writing.
Linux connect(2):
EINPROGRESS
The socket is non-blocking and the connection can-
not be completed immediately. It is possible to
select(2) or poll(2) for completion by selecting
the socket for writing. After select indicates
writability, use getsockopt(2) to read the SO_ERROR
option at level SOL_SOCKET to determine whether
connect completed successfully (SO_ERROR is zero)
or unsuccessfully (SO_ERROR is one of the usual
error codes listed here, explaining the reason for
the failure).
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]