From: Sam Liddicott Date: Tue, 9 Jun 2009 11:51:44 +0000 (+0100) Subject: s4: smbcli_transport_send hit the socket right away if possible X-Git-Tag: tdb-1.1.5~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebf5523b6e2ae0;p=thirdparty%2Fsamba.git s4: smbcli_transport_send hit the socket right away if possible [Metze; "make test" on git master outputs exactly the same test summary with our without this patch (apart from the "using seed" lines)] If the transport socket is writable, then push the queue along rather than wait until the caller returns back to the tevent loop. This strategy keeps the sockets piping hot, and is particularly good for cases where reading requests from one socket causes lots of writes on another socket, or where lots of writes are made in a batch. It doesn't matter if the socket is not writeable yet, packet_queue_run will return quite cheaply in such a case. Signed-off-by: Sam Liddicott Signed-off-by: Stefan Metzmacher --- diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 0ced607b1e5..f5e81cd6f69 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -593,6 +593,13 @@ void smbcli_transport_send(struct smbcli_request *req) return; } + packet_queue_run(req->transport->packet); + if (req->transport->socket->sock == NULL) { + req->state = SMBCLI_REQUEST_ERROR; + req->status = NT_STATUS_NET_WRITE_FAULT; + return; + } + if (req->one_way_request) { req->state = SMBCLI_REQUEST_DONE; smbcli_request_destroy(req);