]> git.ipfire.org Git - thirdparty/samba.git/commit
s3:lib: avoid calling async_connect_send() again and again in open_socket_out*()
authorStefan Metzmacher <metze@samba.org>
Wed, 26 Feb 2020 12:36:05 +0000 (13:36 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 26 Feb 2020 19:45:36 +0000 (19:45 +0000)
commita26be7eeedc4995ea1a99f4bbb6ce8beaafda012
tree107746793ffe455b93df81155117939ff080f69b
parentd48fba7c09603e0dcfc7d268d07eec557759b968
s3:lib: avoid calling async_connect_send() again and again in open_socket_out*()

There's really no need to do that!

Once connect() is called and returned EINPROGRESS, the kernel
knowns what to do and reports any state change via
TEVENT_FD_READ or TEVENT_FD_WRITE.
The actual success or failure is available via
getsockopt(.., SOL_SOCKET, SO_ERROR, ...).

Before this commit we called connect() (via async_connect_send()) again
and again until we reached the final caller provided timeout,
even if the kernel already found out that the destination is
unreachable.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/util_sock.c