diff options
-rw-r--r-- | lib/tsocket/tsocket_bsd.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c index d5721b4d94..135fd027aa 100644 --- a/lib/tsocket/tsocket_bsd.c +++ b/lib/tsocket/tsocket_bsd.c @@ -792,7 +792,7 @@ static int tdgram_bsd_set_writeable_handler(struct tdgram_bsd *bsds, struct tdgram_bsd_recvfrom_state { struct tdgram_context *dgram; - + bool first_try; uint8_t *buf; size_t len; struct tsocket_address *src; @@ -826,6 +826,7 @@ static struct tevent_req *tdgram_bsd_recvfrom_send(TALLOC_CTX *mem_ctx, } state->dgram = dgram; + state->first_try= true; state->buf = NULL; state->len = 0; state->src = NULL; @@ -876,6 +877,13 @@ static void tdgram_bsd_recvfrom_handler(void *private_data) bool retry; ret = tsocket_bsd_pending(bsds->fd); + if (state->first_try && ret == 0) { + state->first_try = false; + /* retry later */ + return; + } + state->first_try = false; + err = tsocket_bsd_error_from_errno(ret, errno, &retry); if (retry) { /* retry later */ |