Mercurial > hg > freeDiameter
changeset 1115:a325f95de659
Set absolute timeout in second place.
author | Thomas Klausner <tk@giga.or.at> |
---|---|
date | Mon, 13 May 2013 12:58:05 +0200 |
parents | b6885b0d8b10 |
children | 5da2ea1585a1 |
files | extensions/rt_busypeers/rtbusy.c |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/rt_busypeers/rtbusy.c Mon May 13 11:46:14 2013 +0200 +++ b/extensions/rt_busypeers/rtbusy.c Mon May 13 12:58:05 2013 +0200 @@ -106,8 +106,11 @@ } /* Send the query again. We need to re-associate the expirecb which was cleaned, if it is used */ if (rtbusy_conf.RelayTimeout) { - struct timespec tm = { .tv_sec = rtbusy_conf.RelayTimeout/1000, .tv_nsec=1000000LL * (rtbusy_conf.RelayTimeout % 1000) }; - CHECK_FCT( fd_msg_send_timeout( pmsg, NULL, NULL, rtbusy_expirecb, &tm ) ); + struct timespec expire; + CHECK_SYS( clock_gettime(CLOCK_REALTIME, &expire) ); + expire.tv_sec += rtbusy_conf.RelayTimeout/1000 + ((expire.tv_nsec + (1000000LL * (rtbusy_conf.RelayTimeout % 1000))) / 1000000000LL); + expire.tv_nsec = (expire.tv_nsec + (1000000LL * (rtbusy_conf.RelayTimeout % 1000))) % 1000000000LL; + CHECK_FCT( fd_msg_send_timeout( pmsg, NULL, NULL, rtbusy_expirecb, &expire ) ); } else { CHECK_FCT( fd_msg_send(pmsg, NULL, NULL) ); }