The branch, master has been updated
       via  d2aa785 lib/tsocket: fix loop in tdgram_bsd_recvfrom() (bug #9184)
      from  7138b21 build: Add #define FREEBSD on FreeBSD

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d2aa785290a283e06624f22a381a7ea02baae5ad
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Oct 2 12:20:26 2012 +0200

    lib/tsocket: fix loop in tdgram_bsd_recvfrom() (bug #9184)
    
    If the socket is not readable yet, we need to retry
    if tsocket_bsd_pending() returns 0.
    
    See also
    https://lists.samba.org/archive/samba-technical/2012-October/087164.html
    
    metze
    
    Autobuild-User(master): Andrew Bartlett <abart...@samba.org>
    Autobuild-Date(master): Tue Oct 23 14:44:21 CEST 2012 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 lib/tsocket/tsocket_bsd.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
index d5721b4..135fd02 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 */


-- 
Samba Shared Repository

Reply via email to