Mercurial > hg > freeDiameter
changeset 1108:7ee7b95701c9
Change the rt_busy parameter to milliseconds
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Mon, 13 May 2013 09:46:39 +0800 |
parents | 96f2051215c8 |
children | 4f33090b96bf |
files | doc/rt_busypeers.conf.sample extensions/rt_busypeers/rtbusy.c |
diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/rt_busypeers.conf.sample Sun May 12 16:39:07 2013 +0200 +++ b/doc/rt_busypeers.conf.sample Mon May 13 09:46:39 2013 +0800 @@ -39,7 +39,7 @@ # Parameter: RelayTimeout -# If the value of this parameter is not 0, it specifies the number of seconds that the local relay waits for an answer to a +# If the value of this parameter is not 0, it specifies the number of milliseconds (1/1000 s) that the local relay waits for an answer to a # forwarded request before considering the remote peer is busy and taking corrective action (similar as if that relay had returned TOO_BUSY status). # Note: this parameter does not apply for requests issued locally. In that case, the extension issuing the request should directly specify the timeout. # Default: 0, meaning that there is no timeout parameter.
--- a/extensions/rt_busypeers/rtbusy.c Sun May 12 16:39:07 2013 +0200 +++ b/extensions/rt_busypeers/rtbusy.c Mon May 13 09:46:39 2013 +0800 @@ -106,7 +106,7 @@ } /* 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, .tv_nsec=0 }; + 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 ) ); } else { CHECK_FCT( fd_msg_send(pmsg, NULL, NULL) ); @@ -117,7 +117,7 @@ /* We must create an answer */ CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, pmsg, MSGFL_ANSW_ERROR ) ); - CHECK_FCT( fd_msg_rescode_set(*pmsg, "DIAMETER_TOO_BUSY", "[rt_busypeers] Timeout reached while waiting for an anwer", NULL, 1 ) ); + CHECK_FCT( fd_msg_rescode_set(*pmsg, "DIAMETER_TOO_BUSY", "[rt_busypeers] Timeout reached while waiting for an answer", NULL, 1 ) ); CHECK_FCT( fd_msg_send(pmsg, NULL, NULL) ); } @@ -148,7 +148,7 @@ /* 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, .tv_nsec=0 }; + 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 ) ); return 0; }