summaryrefslogtreecommitdiff
path: root/lib/tsocket
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-03-11 17:11:22 +0100
committerStefan Metzmacher <metze@samba.org>2009-03-19 16:25:57 +0100
commitb900e9242512e35f7f805ba4f4ce1624c2677d8b (patch)
tree43dd203905019e01a230adf30a69ccf784f378e7 /lib/tsocket
parent235a7a420b72068403d38b47b123faf4481bef08 (diff)
downloadsamba-b900e9242512e35f7f805ba4f4ce1624c2677d8b.tar.gz
samba-b900e9242512e35f7f805ba4f4ce1624c2677d8b.tar.bz2
samba-b900e9242512e35f7f805ba4f4ce1624c2677d8b.zip
lib/tsocket: add a fast path to tsocket_sendto_send/recv()
By first trying to send data without waiting for the socket to become writeable we gain about 10-20% performance in the LDAP-BENCH-CLDAP test. metze
Diffstat (limited to 'lib/tsocket')
-rw-r--r--lib/tsocket/tsocket_sendto.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/tsocket/tsocket_sendto.c b/lib/tsocket/tsocket_sendto.c
index 4531c40321..9c0a76bf16 100644
--- a/lib/tsocket/tsocket_sendto.c
+++ b/lib/tsocket/tsocket_sendto.c
@@ -75,6 +75,16 @@ struct tevent_req *tsocket_sendto_send(struct tsocket_context *sock,
state->caller.dst = dst;
state->ret = -1;
+ /*
+ * this is a fast path, not waiting for the
+ * socket to become explicit writeable gains
+ * about 10%-20% performance in benchmark tests.
+ */
+ tsocket_sendto_handler(sock, req);
+ if (!tevent_req_is_in_progress(req)) {
+ goto post;
+ }
+
talloc_set_destructor(state, tsocket_sendto_state_destructor);
ret = tsocket_set_writeable_handler(sock,