[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Wed Aug 10 01:55:02 MDT 2011


The branch, master has been updated
       via  0a9c30f Revert "s3:test_async_echo: unsure the desired smb message sequence"
       via  b97aab0 tsocket: make use of tevent_queue_add_optimize_empty() to optimize for the empty queue case
      from  4a5e9cf s4:subtree_rename LDB module - fix the move/rename constraints

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


- Log -----------------------------------------------------------------
commit 0a9c30f5096523f98aa2b8b1b4cbd3f0649a9eb9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jul 28 11:39:32 2011 +0200

    Revert "s3:test_async_echo: unsure the desired smb message sequence"
    
    This reverts commit 34faeb8bba86fff57466c06682b7dcbffc48a52a.
    
    This is not needed anymore.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Wed Aug 10 09:54:24 CEST 2011 on sn-devel-104

commit b97aab0223746870429255acac5607062781a266
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jul 28 10:37:51 2011 +0200

    tsocket: make use of tevent_queue_add_optimize_empty() to optimize for the empty queue case
    
    metze

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

Summary of changes:
 lib/tsocket/tsocket_helpers.c     |   85 +++++++++++++++++++++----------------
 source3/torture/test_async_echo.c |   10 ----
 2 files changed, 48 insertions(+), 47 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tsocket/tsocket_helpers.c b/lib/tsocket/tsocket_helpers.c
index db6b614..1b92b9f 100644
--- a/lib/tsocket/tsocket_helpers.c
+++ b/lib/tsocket/tsocket_helpers.c
@@ -52,7 +52,7 @@ struct tevent_req *tdgram_sendto_queue_send(TALLOC_CTX *mem_ctx,
 {
 	struct tevent_req *req;
 	struct tdgram_sendto_queue_state *state;
-	bool ok;
+	struct tevent_queue_entry *e;
 
 	req = tevent_req_create(mem_ctx, &state,
 				struct tdgram_sendto_queue_state);
@@ -67,21 +67,24 @@ struct tevent_req *tdgram_sendto_queue_send(TALLOC_CTX *mem_ctx,
 	state->caller.dst	= dst;
 	state->ret		= -1;
 
-	ok = tevent_queue_add(queue,
-			      ev,
-			      req,
-			      tdgram_sendto_queue_trigger,
-			      NULL);
-	if (!ok) {
-		tevent_req_oom(req);
-		goto post;
+	/*
+	 * we use tevent_queue_add_optimize_empty() with allow_direct
+	 * in order to optimize for the empty queue case.
+	 */
+	e = tevent_queue_add_optimize_empty(
+				queue,
+				ev,
+				req,
+				tdgram_sendto_queue_trigger,
+				NULL);
+	if (tevent_req_nomem(e, req)) {
+		return tevent_req_post(req, ev);
+	}
+	if (!tevent_req_is_in_progress(req)) {
+		return tevent_req_post(req, ev);
 	}
 
 	return req;
-
- post:
-	tevent_req_post(req, ev);
-	return req;
 }
 
 static void tdgram_sendto_queue_trigger(struct tevent_req *req,
@@ -326,7 +329,7 @@ struct tevent_req *tstream_readv_pdu_queue_send(TALLOC_CTX *mem_ctx,
 {
 	struct tevent_req *req;
 	struct tstream_readv_pdu_queue_state *state;
-	bool ok;
+	struct tevent_queue_entry *e;
 
 	req = tevent_req_create(mem_ctx, &state,
 				struct tstream_readv_pdu_queue_state);
@@ -340,20 +343,24 @@ struct tevent_req *tstream_readv_pdu_queue_send(TALLOC_CTX *mem_ctx,
 	state->caller.next_vector_private	= next_vector_private;
 	state->ret				= -1;
 
-	ok = tevent_queue_add(queue,
-			      ev,
-			      req,
-			      tstream_readv_pdu_queue_trigger,
-			      NULL);
-	if (!ok) {
-		tevent_req_oom(req);
-		goto post;
+	/*
+	 * we use tevent_queue_add_optimize_empty() with allow_direct
+	 * in order to optimize for the empty queue case.
+	 */
+	e = tevent_queue_add_optimize_empty(
+				queue,
+				ev,
+				req,
+				tstream_readv_pdu_queue_trigger,
+				NULL);
+	if (tevent_req_nomem(e, req)) {
+		return tevent_req_post(req, ev);
+	}
+	if (!tevent_req_is_in_progress(req)) {
+		return tevent_req_post(req, ev);
 	}
 
 	return req;
-
- post:
-	return tevent_req_post(req, ev);
 }
 
 static void tstream_readv_pdu_queue_trigger(struct tevent_req *req,
@@ -433,7 +440,7 @@ struct tevent_req *tstream_writev_queue_send(TALLOC_CTX *mem_ctx,
 {
 	struct tevent_req *req;
 	struct tstream_writev_queue_state *state;
-	bool ok;
+	struct tevent_queue_entry *e;
 
 	req = tevent_req_create(mem_ctx, &state,
 				struct tstream_writev_queue_state);
@@ -447,20 +454,24 @@ struct tevent_req *tstream_writev_queue_send(TALLOC_CTX *mem_ctx,
 	state->caller.count	= count;
 	state->ret		= -1;
 
-	ok = tevent_queue_add(queue,
-			      ev,
-			      req,
-			      tstream_writev_queue_trigger,
-			      NULL);
-	if (!ok) {
-		tevent_req_oom(req);
-		goto post;
+	/*
+	 * we use tevent_queue_add_optimize_empty() with allow_direct
+	 * in order to optimize for the empty queue case.
+	 */
+	e = tevent_queue_add_optimize_empty(
+				queue,
+				ev,
+				req,
+				tstream_writev_queue_trigger,
+				NULL);
+	if (tevent_req_nomem(e, req)) {
+		return tevent_req_post(req, ev);
+	}
+	if (!tevent_req_is_in_progress(req)) {
+		return tevent_req_post(req, ev);
 	}
 
 	return req;
-
- post:
-	return tevent_req_post(req, ev);
 }
 
 static void tstream_writev_queue_trigger(struct tevent_req *req,
diff --git a/source3/torture/test_async_echo.c b/source3/torture/test_async_echo.c
index eb1f1d4..cca6975 100644
--- a/source3/torture/test_async_echo.c
+++ b/source3/torture/test_async_echo.c
@@ -20,7 +20,6 @@
 #include "includes.h"
 #include "torture/proto.h"
 #include "libsmb/libsmb.h"
-#include "async_smb.h"
 #include "rpc_client/cli_pipe.h"
 #include "librpc/gen_ndr/ndr_echo_c.h"
 
@@ -101,15 +100,6 @@ bool run_async_echo(int dummy)
 	tevent_req_set_callback(req, rpccli_sleep_done, &num_reqs);
 	num_reqs += 1;
 
-	/* Wait until the rpc operation arrives at the smb layer */
-	while (tevent_req_is_in_progress(req) &&
-	       !cli_has_async_calls(cli)) {
-		if (tevent_loop_once(ev) != 0) {
-			printf("tevent_loop_once failed\n");
-			goto fail;
-		}
-	}
-
 	req = cli_echo_send(ev, ev, cli, 1, data_blob_const("hello", 5));
 	if (req == NULL) {
 		printf("cli_echo_send failed\n");


-- 
Samba Shared Repository


More information about the samba-cvs mailing list