+7
−7
Loading
Lack of POLLOUT indicates an error but there is no hint about potential
reason hence reorder checks to to have SO_ERROR check first.
Note this is not clearly described as allowed by connect() man page.
EINPROGRESS
The socket is nonblocking and the connection cannot be
completed immediately. (UNIX domain sockets failed with
EAGAIN instead.) It is possible to select(2) or poll(2)
for completion by selecting the socket for writing. After
select(2) 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).
However, it is experimentally proven that in case of target being
unreachable only POLLERR event can be returned and with SO_ERROR check
we get 113 (EHOSTUNREACH) as a valuable hint.
Change-Id: I1a59af52415dc34efa819007d56738a149d9df0c
Signed-off-by:
Jacek Kalwas <jacek.kalwas@nutanix.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/25953
Reviewed-by:
Tomasz Zawadzki <tomasz@tzawadzki.com>
Community-CI: Mellanox Build Bot
Reviewed-by:
Ben Walker <ben@nvidia.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by:
SPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by:
Aleksey Marchuk <alexeymar@nvidia.com>