# HG changeset patch # User Sebastien Decugis # Date 1368182959 -28800 # Node ID 757df62cadb602529ec7ae9e05f9e33782661699 # Parent d8591b1c56cdbd7c11457e4205cca7479a0bbc6b# Parent a1d6e198013292baa077357200a37f57bb308ca2 Merge diff -r d8591b1c56cd -r 757df62cadb6 libfdcore/p_psm.c --- a/libfdcore/p_psm.c Fri May 10 18:48:57 2013 +0800 +++ b/libfdcore/p_psm.c Fri May 10 18:49:19 2013 +0800 @@ -335,7 +335,7 @@ /* Add a random value between 0 and 4sec */ peer->p_psm_timer.tv_sec += random() % 4; peer->p_psm_timer.tv_nsec+= random() % 1000000000L; - if (peer->p_psm_timer.tv_nsec > 1000000000L) { + if (peer->p_psm_timer.tv_nsec >= 1000000000L) { peer->p_psm_timer.tv_nsec -= 1000000000L; peer->p_psm_timer.tv_sec ++; } diff -r d8591b1c56cd -r 757df62cadb6 libfdproto/fifo.c --- a/libfdproto/fifo.c Fri May 10 18:48:57 2013 +0800 +++ b/libfdproto/fifo.c Fri May 10 18:49:19 2013 +0800 @@ -578,8 +578,8 @@ /* The internal function for fd_fifo_timedget and fd_fifo_get */ static int fifo_tget ( struct fifo * queue, void ** item, int istimed, const struct timespec *abstime) { - int timedout = 0; int call_cb = 0; + int ret = 0; /* Check the parameters */ CHECK_PARAMS( CHECK_FIFO( queue ) && item && (abstime || !istimed) ); @@ -604,7 +604,6 @@ *item = mq_pop(queue); call_cb = test_l_cb(queue); } else { - int ret = 0; /* We have to wait for a new item */ queue->thrs++ ; pthread_cleanup_push( fifo_cleanup, queue); @@ -618,12 +617,7 @@ if (ret == 0) goto awaken; /* test for spurious wake-ups */ - if (istimed && (ret == ETIMEDOUT)) { - timedout = 1; - } else { - /* Unexpected error condition (means we need to debug) */ - ASSERT( ret == 0 /* never true */ ); - } + /* otherwise (ETIMEDOUT / other error) just continue */ } /* Unlock */ @@ -634,7 +628,7 @@ (*queue->l_cb)(queue, &queue->data); /* Done */ - return timedout ? ETIMEDOUT : 0; + return ret; } /* Get the next available item, block until there is one */