s4:wrepl_server: make use of tstream_bsd_fail_readv_first_error(true)
authorStefan Metzmacher <metze@samba.org>
Thu, 12 Jan 2023 09:46:20 +0000 (10:46 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 24 Oct 2023 09:36:38 +0000 (09:36 +0000)
This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/wrepl_server/wrepl_in_connection.c

index c68214dcbd248a5ef0ad72ca0735b1531f7360d5..1cdc40968e2d8a14ae97eb5b9710f89de15495db 100644 (file)
@@ -133,6 +133,8 @@ static void wreplsrv_accept(struct stream_connection *conn)
                return;
        }
        socket_set_flags(conn->socket, SOCKET_FLAG_NOCLOSE);
+       /* as server we want to fail early */
+       tstream_bsd_fail_readv_first_error(wrepl_conn->tstream, true);
 
        wrepl_conn->conn = conn;
        wrepl_conn->service = service;
@@ -388,6 +390,9 @@ NTSTATUS wreplsrv_in_connection_merge(struct wreplsrv_partner *partner,
                return NT_STATUS_NO_MEMORY;
        }
 
+       /* we're now a server and want to fail early */
+       tstream_bsd_fail_readv_first_error(wrepl_in->tstream, true);
+
        /*
         * The wrepl pdu's has the length as 4 byte (initial_read_size),
         * packet_full_request_u32 provides the pdu length then.