lib/tsocket: add a comment regarding TEVENT_FD_READ in tstream_bsd_connect_send()
authorStefan Metzmacher <metze@samba.org>
Wed, 26 Feb 2020 15:36:30 +0000 (16:36 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 26 Feb 2020 19:45:36 +0000 (19:45 +0000)
This is different compared to the raw usage of [e]poll
where [E]POLLOUT is enough to see errors via POLLERR/POLLHUP.

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

index 1627051f3ec548f46f27b4b87c4a29e5f71df7af..6ad40bd0ada66423ca4bef4e8f06c46ac0cda4ff 100644 (file)
@@ -2341,6 +2341,14 @@ static struct tevent_req *tstream_bsd_connect_send(TALLOC_CTX *mem_ctx,
        goto post;
 
  async:
+
+       /*
+        * Note for historic reasons TEVENT_FD_WRITE is not enough
+        * to get notified for POLLERR or EPOLLHUP even if they
+        * come together with POLLOUT. That means we need to
+        * use TEVENT_FD_READ in addition until we have
+        * TEVENT_FD_ERROR.
+        */
        state->fde = tevent_add_fd(ev, state,
                                   state->fd,
                                   TEVENT_FD_READ | TEVENT_FD_WRITE,