For callers using tdgram_bsd_optimize_recvfrom() it is every useful
to know it data was already waiting in the socket.
In that case the result from tdgram_bsd_recvfrom_send() would
already report tevent_req_is_in_progress() as false.
But the result of tdgram_recvfrom_send() available to the
caller would see tevent_req_is_in_progress() reporting true.
With this change also the result of tdgram_recvfrom_send()
would report tevent_req_is_in_progress() as false,
which will be useful for callers, which would otherwise
set a timeout on the request.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
goto post;
}
tevent_req_set_callback(subreq, tdgram_recvfrom_done, req);
+ if (!tevent_req_is_in_progress(subreq)) {
+ /*
+ * Allow the caller of
+ * tdgram_recvfrom_send() to
+ * see tevent_req_is_in_progress()
+ * reporting false too.
+ *
+ * Useful for callers using
+ * tdgram_bsd_optimize_recvfrom(true)
+ * in order to check if data
+ * was already waiting in the
+ * receice buffer.
+ */
+ tdgram_recvfrom_done(subreq);
+ goto post;
+ }
return req;