Balazs Scheidler <[EMAIL PROTECTED]> writes:
> I think some error handling may be missing from connect_callback, as the man
> page states, select() returns writable for a connecting fd even if the
> connection was not successful:
[doc skipped]
Without this test, I would think that the error will be detected when
the process attempts to write to the socket (select/poll will still
indicate it is writeble). But I guess it's better to check for failed
connections right away. It's possible that we won't attempt writing to
the socket before having read something, and in this case we could
wait forever.
I added a test in connect_callback in io.c. If the socket's error
status is non-zero, it invokes the fd callback with an argument -1.
The connect function in io_commands.c checks for this, and invokes its
continuation with a NULL argument.
> EINPROGRESS
> The socket is non-blocking and the connection can-
> not be completed immediately. It is possible to
> select(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 com-
> pleted successfully (SO_ERROR is zero) or unsuc-
> cessfully (SO_ERROR is one of the usual error
^^^^^^^^^^^
> codes listed above, explaining the reason for the
> failure).
Which error codes? I can't find the above information in the solaris
manpage at all. It only says that completed connections are detected
by polling or selecting for write.
/Niels