tsocket: try to fix the build on solaris FIONREAD was missing
[ira/wip.git] / lib / tsocket / tsocket_sendto.c
index 4531c403212976af202e08f13415a5e9b838e250..9c0a76bf166b42ca5da78b8124aefa8fa45231d8 100644 (file)
@@ -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,