[SCM] Samba Shared Repository - branch master updated - 2fe7d5936aea2ab74bf63997212f509e4a3ccee4

Volker Lendecke vlendec at samba.org
Fri Dec 19 12:48:47 GMT 2008


The branch, master has been updated
       via  2fe7d5936aea2ab74bf63997212f509e4a3ccee4 (commit)
      from  3c6d070595dee97151afa6eba6cef3ebe6ee3cfb (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2fe7d5936aea2ab74bf63997212f509e4a3ccee4
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 15 12:06:00 2008 +0100

    Prefer network writes over reads
    
    If we really want to keep the pipe busy, we need to write everything we have as
    early as possible, giving the kernel the chance to get rid of the buffers
    quickly :-)

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/async_smb.c |   65 ++++++++++++++++++++++---------------------
 1 files changed, 33 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index fd2fe93..522d73f 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -955,6 +955,39 @@ static void cli_state_handler(struct event_context *event_ctx,
 
 	DEBUG(11, ("cli_state_handler called with flags %d\n", flags));
 
+	if (flags & EVENT_FD_WRITE) {
+		size_t to_send;
+		ssize_t sent;
+
+		for (req = cli->outstanding_requests; req; req = req->next) {
+			to_send = smb_len(req->outbuf)+4;
+			if (to_send > req->sent) {
+				break;
+			}
+		}
+
+		if (req == NULL) {
+			if (cli->fd_event != NULL) {
+				event_fd_set_not_writeable(cli->fd_event);
+			}
+			return;
+		}
+
+		sent = sys_send(cli->fd, req->outbuf + req->sent,
+			    to_send - req->sent, 0);
+
+		if (sent < 0) {
+			status = map_nt_error_from_unix(errno);
+			goto sock_error;
+		}
+
+		req->sent += sent;
+
+		if (req->sent == to_send) {
+			return;
+		}
+	}
+
 	if (flags & EVENT_FD_READ) {
 		int res, available;
 		size_t old_size, new_size;
@@ -1020,38 +1053,6 @@ static void cli_state_handler(struct event_context *event_ctx,
 		}
 	}
 
-	if (flags & EVENT_FD_WRITE) {
-		size_t to_send;
-		ssize_t sent;
-
-		for (req = cli->outstanding_requests; req; req = req->next) {
-			to_send = smb_len(req->outbuf)+4;
-			if (to_send > req->sent) {
-				break;
-			}
-		}
-
-		if (req == NULL) {
-			if (cli->fd_event != NULL) {
-				event_fd_set_not_writeable(cli->fd_event);
-			}
-			return;
-		}
-
-		sent = sys_send(cli->fd, req->outbuf + req->sent,
-			    to_send - req->sent, 0);
-
-		if (sent < 0) {
-			status = map_nt_error_from_unix(errno);
-			goto sock_error;
-		}
-
-		req->sent += sent;
-
-		if (req->sent == to_send) {
-			return;
-		}
-	}
 	return;
 
  sock_error:


-- 
Samba Shared Repository


More information about the samba-cvs mailing list