# HG changeset patch # User Sebastien Decugis # Date 1368411130 -28800 # Node ID 4f33090b96bf04276ac4cf2db7042a1c2786665e # Parent 7ee7b95701c9d6562456bc2dae3c661dbc2dad38 Fix handling of the timeout value diff -r 7ee7b95701c9 -r 4f33090b96bf extensions/rt_busypeers/rtbusy.c --- a/extensions/rt_busypeers/rtbusy.c Mon May 13 09:46:39 2013 +0800 +++ b/extensions/rt_busypeers/rtbusy.c Mon May 13 10:12:10 2013 +0800 @@ -148,8 +148,11 @@ /* If the message is a request, we only associate the timeout */ if (hdr->msg_flags & CMD_FLAG_REQUEST) { - struct timespec tm = { .tv_sec = rtbusy_conf.RelayTimeout/1000, .tv_nsec=1000000LL * (rtbusy_conf.RelayTimeout % 1000) }; - CHECK_FCT( fd_msg_anscb_associate( *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_anscb_associate( *pmsg, NULL, NULL, rtbusy_expirecb, &expire ) ); return 0; }