lib/tsocket: add a fast path to tsocket_writev_send/recv()
authorStefan Metzmacher <metze@samba.org>
Wed, 11 Mar 2009 16:27:03 +0000 (17:27 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 19 Mar 2009 15:25:57 +0000 (16:25 +0100)
This is similar to the tsocket_sendto_send/recv() fast path.

metze

lib/tsocket/tsocket_writev.c

index 27f28a60e46206c76880dc28c2a5c5c79d2f1f50..8c5cd40385aa6baace1efa6bb9af76ec5dfcc62c 100644 (file)
@@ -103,6 +103,16 @@ struct tevent_req *tsocket_writev_send(struct tsocket_context *sock,
                goto post;
        }
 
                goto post;
        }
 
+       /*
+        * this is a fast path, not waiting for the
+        * socket to become explicit writeable gains
+        * about 10%-20% performance in benchmark tests.
+        */
+       tsocket_writev_handler(sock, req);
+       if (!tevent_req_is_in_progress(req)) {
+               goto post;
+       }
+
        talloc_set_destructor(state, tsocket_writev_state_destructor);
 
        ret = tsocket_set_writeable_handler(sock,
        talloc_set_destructor(state, tsocket_writev_state_destructor);
 
        ret = tsocket_set_writeable_handler(sock,