Add iburst server option

This commit is contained in:
Miroslav Lichvar 2010-04-23 12:40:50 +02:00
parent be4369936b
commit 93b5b08bed
7 changed files with 18 additions and 1 deletions

View file

@ -215,6 +215,7 @@ typedef struct {
/* Flags used in NTP source requests */
#define REQ_ADDSRC_ONLINE 0x1
#define REQ_ADDSRC_AUTOOFFLINE 0x2
#define REQ_ADDSRC_IBURST 0x4
typedef struct {
IPAddr ip_addr;

View file

@ -2597,6 +2597,10 @@ chrony when disconnecting the dial-up link. (It will still be necessary to use
chronyc's @code{online} (@pxref{online command}) command when the link has been
established, to enable measurements to start.)
@item iburst
On start, make four measurements over a short duration (rather than
the usual periodic measurements).
@end table
@c }}}
@c {{{ tempcomp

View file

@ -912,7 +912,8 @@ process_cmd_add_server_or_peer(CMD_Request *msg, char *line)
msg->data.ntp_source.max_delay_ratio = UTI_FloatHostToNetwork(data.params.max_delay_ratio);
msg->data.ntp_source.flags = htonl(
(data.params.online ? REQ_ADDSRC_ONLINE : 0) |
(data.params.auto_offline ? REQ_ADDSRC_AUTOOFFLINE : 0));
(data.params.auto_offline ? REQ_ADDSRC_AUTOOFFLINE : 0) |
(data.params.iburst ? REQ_ADDSRC_IBURST : 0));
result = 1;
break;

View file

@ -1230,6 +1230,7 @@ handle_add_server(CMD_Request *rx_message, CMD_Reply *tx_message)
params.authkey = ntohl(rx_message->data.ntp_source.authkey);
params.online = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_ONLINE ? 1 : 0;
params.auto_offline = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_AUTOOFFLINE ? 1 : 0;
params.iburst = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_IBURST ? 1 : 0;
params.max_delay = UTI_FloatNetworkToHost(rx_message->data.ntp_source.max_delay);
params.max_delay_ratio = UTI_FloatNetworkToHost(rx_message->data.ntp_source.max_delay_ratio);
status = NSR_AddServer(&rem_addr, &params);
@ -1270,6 +1271,7 @@ handle_add_peer(CMD_Request *rx_message, CMD_Reply *tx_message)
params.authkey = ntohl(rx_message->data.ntp_source.authkey);
params.online = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_ONLINE ? 1 : 0;
params.auto_offline = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_AUTOOFFLINE ? 1 : 0;
params.iburst = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_IBURST ? 1 : 0;
params.max_delay = UTI_FloatNetworkToHost(rx_message->data.ntp_source.max_delay);
params.max_delay_ratio = UTI_FloatNetworkToHost(rx_message->data.ntp_source.max_delay_ratio);
status = NSR_AddPeer(&rem_addr, &params);

View file

@ -56,6 +56,7 @@ CPS_ParseNTPSourceAdd(const char *line, CPS_NTP_Source *src)
src->params.max_delay_ratio = 16384.0;
src->params.online = 1;
src->params.auto_offline = 0;
src->params.iburst = 0;
result = CPS_Success;
@ -143,6 +144,9 @@ CPS_ParseNTPSourceAdd(const char *line, CPS_NTP_Source *src)
} else if (!strncasecmp(cmd, "auto_offline", 12)) {
src->params.auto_offline = 1;
} else if (!strncasecmp(cmd, "iburst", 6)) {
src->params.iburst = 1;
} else {
result = CPS_BadOption;
ok = 0;

View file

@ -290,6 +290,10 @@ create_instance(NTP_Remote_Address *remote_addr, NTP_Mode mode, SourceParameters
result->opmode = MD_OFFLINE;
}
if (params->iburst) {
NCR_InitiateSampleBurst(result, 4, 8);
}
result->auto_offline = params->auto_offline;
result->local_poll = params->minpoll;

View file

@ -37,6 +37,7 @@ typedef struct {
int online;
int auto_offline;
int presend_minpoll;
int iburst;
unsigned long authkey;
double max_delay;
double max_delay_ratio;