Mercurial > hg > freeDiameter
changeset 1104:757df62cadb6
Merge
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Fri, 10 May 2013 18:49:19 +0800 |
parents | d8591b1c56cd (current diff) a1d6e1980132 (diff) |
children | 8401adfb58f5 |
files | libfdcore/p_psm.c libfdproto/fifo.c |
diffstat | 2 files changed, 4 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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 ++; }
--- 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 */