Re: [chrony-dev] [PATCH] local threshold option

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Fri, Mar 29, 2024 at 01:44:34AM +0000, Andy Fiddaman wrote:
> I've attached the latest patch.
> 
> I'm happy to go back and do something here if you'd like, but also
> please feel free to adjust what I've done here to better fit the
> goals of the project.

I applied the patch with some fixes. I hope that's ok.

> @@ -1648,8 +1650,8 @@ read_from_cmd_socket(int sock_fd, int event, void *anything)
>          case REQ_SETTIME:
>            handle_settime(&rx_message, &tx_message);
>            break;
> -        
> -        case REQ_LOCAL2:
> +
> +        case REQ_LOCAL3:
>            handle_local(&rx_message, &tx_message);
>            break;

The corresponding change is missing in client.c

>    /* Local reference is active when enabled and the clock is not synchronised
>       or the root distance exceeds the threshold */
> -
>    if (are_we_synchronised &&
> -      !(enable_local_stratum && our_root_delay / 2 + dispersion > local_distance)) {
> +      !(enable_local_stratum && distance > local_distance)) {

This is missing local_activate_ok to prevent unsynchronized status
when the distance check passes but activation not. I added some tests
for that in a separate commit, so hopefully it works as expected.
>  
>      *is_synchronised = 1;
>  
> @@ -1158,7 +1166,7 @@ REF_GetReferenceParams
>      *root_delay = our_root_delay;
>      *root_dispersion = dispersion;
>  
> -  } else if (enable_local_stratum) {
> +  } else if (enable_local_stratum && local_activate_ok) {
>  
>      *is_synchronised = 0;
>  

Thanks,

-- 
Miroslav Lichvar


-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/