ntp: rename receive_packet() to process_response()
This commit is contained in:
parent
cb8660e79a
commit
2d492eacb5
2 changed files with 14 additions and 14 deletions
|
@ -1559,7 +1559,7 @@ process_sample(NCR_Instance inst, NTP_Sample *sample)
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr,
|
process_response(NCR_Instance inst, NTP_Local_Address *local_addr,
|
||||||
NTP_Local_Timestamp *rx_ts, NTP_Packet *message, NTP_PacketInfo *info)
|
NTP_Local_Timestamp *rx_ts, NTP_Packet *message, NTP_PacketInfo *info)
|
||||||
{
|
{
|
||||||
NTP_Sample sample;
|
NTP_Sample sample;
|
||||||
|
@ -2112,7 +2112,7 @@ NCR_ProcessRxKnown(NCR_Instance inst, NTP_Local_Address *local_addr,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return receive_packet(inst, local_addr, rx_ts, message, &info);
|
return process_response(inst, local_addr, rx_ts, message, &info);
|
||||||
} else if (proc_as_unknown) {
|
} else if (proc_as_unknown) {
|
||||||
NCR_ProcessRxUnknown(&inst->remote_addr, local_addr, rx_ts, message, length);
|
NCR_ProcessRxUnknown(&inst->remote_addr, local_addr, rx_ts, message, length);
|
||||||
/* It's not a reply to our request, don't return success */
|
/* It's not a reply to our request, don't return success */
|
||||||
|
|
|
@ -232,7 +232,7 @@ send_response(int interleaved, int authenticated, int allow_update, int valid_ts
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_response(NCR_Instance inst, int good, int valid, int updated_sync, int updated_init)
|
proc_response(NCR_Instance inst, int good, int valid, int updated_sync, int updated_init)
|
||||||
{
|
{
|
||||||
NTP_Local_Address local_addr;
|
NTP_Local_Address local_addr;
|
||||||
NTP_Local_Timestamp local_ts;
|
NTP_Local_Timestamp local_ts;
|
||||||
|
@ -296,7 +296,7 @@ process_replay(NCR_Instance inst, NTP_Packet *packet_queue,
|
||||||
do {
|
do {
|
||||||
res_buffer = packet_queue[random() % queue_length];
|
res_buffer = packet_queue[random() % queue_length];
|
||||||
} while (!UTI_CompareNtp64(&res_buffer.transmit_ts, &inst->remote_ntp_tx));
|
} while (!UTI_CompareNtp64(&res_buffer.transmit_ts, &inst->remote_ntp_tx));
|
||||||
process_response(inst, 0, 0, 0, updated_init);
|
proc_response(inst, 0, 0, 0, updated_init);
|
||||||
advance_time(1e-6);
|
advance_time(1e-6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,31 +375,31 @@ test_unit(void)
|
||||||
|
|
||||||
send_response(interleaved, authenticated, 1, 0, 1);
|
send_response(interleaved, authenticated, 1, 0, 1);
|
||||||
DEBUG_LOG("response 1");
|
DEBUG_LOG("response 1");
|
||||||
process_response(inst1, 0, 0, 0, updated);
|
proc_response(inst1, 0, 0, 0, updated);
|
||||||
|
|
||||||
if (source.params.authkey) {
|
if (source.params.authkey) {
|
||||||
send_response(interleaved, authenticated, 1, 1, 0);
|
send_response(interleaved, authenticated, 1, 1, 0);
|
||||||
DEBUG_LOG("response 2");
|
DEBUG_LOG("response 2");
|
||||||
process_response(inst1, 0, 0, 0, 0);
|
proc_response(inst1, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_response(interleaved, authenticated, 1, 1, 1);
|
send_response(interleaved, authenticated, 1, 1, 1);
|
||||||
DEBUG_LOG("response 3");
|
DEBUG_LOG("response 3");
|
||||||
process_response(inst1, -1, valid, valid, updated);
|
proc_response(inst1, -1, valid, valid, updated);
|
||||||
DEBUG_LOG("response 4");
|
DEBUG_LOG("response 4");
|
||||||
process_response(inst1, 0, 0, 0, 0);
|
proc_response(inst1, 0, 0, 0, 0);
|
||||||
|
|
||||||
advance_time(-1.0);
|
advance_time(-1.0);
|
||||||
|
|
||||||
send_response(interleaved, authenticated, 1, 1, 1);
|
send_response(interleaved, authenticated, 1, 1, 1);
|
||||||
DEBUG_LOG("response 5");
|
DEBUG_LOG("response 5");
|
||||||
process_response(inst1, 0, 0, 0, updated && valid);
|
proc_response(inst1, 0, 0, 0, updated && valid);
|
||||||
|
|
||||||
advance_time(1.0);
|
advance_time(1.0);
|
||||||
|
|
||||||
send_response(interleaved, authenticated, 1, 1, 1);
|
send_response(interleaved, authenticated, 1, 1, 1);
|
||||||
DEBUG_LOG("response 6");
|
DEBUG_LOG("response 6");
|
||||||
process_response(inst1, 0, 0, valid && updated, updated);
|
proc_response(inst1, 0, 0, valid && updated, updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
NCR_DestroyInstance(inst1);
|
NCR_DestroyInstance(inst1);
|
||||||
|
@ -412,7 +412,7 @@ test_unit(void)
|
||||||
|
|
||||||
send_request(inst1);
|
send_request(inst1);
|
||||||
process_request(&remote_addr);
|
process_request(&remote_addr);
|
||||||
process_response(inst1, 1, 1, 1, 0);
|
proc_response(inst1, 1, 1, 1, 0);
|
||||||
advance_time(1 << inst1->local_poll);
|
advance_time(1 << inst1->local_poll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ test_unit(void)
|
||||||
TEST_CHECK(inst1->valid_timestamps == (j > 0));
|
TEST_CHECK(inst1->valid_timestamps == (j > 0));
|
||||||
|
|
||||||
DEBUG_LOG("response 1->2");
|
DEBUG_LOG("response 1->2");
|
||||||
process_response(inst2, j > source.params.interleaved, j > 0, j > 0, 1);
|
proc_response(inst2, j > source.params.interleaved, j > 0, j > 0, 1);
|
||||||
|
|
||||||
packet_queue[(j * 2) % PACKET_QUEUE_LENGTH] = res_buffer;
|
packet_queue[(j * 2) % PACKET_QUEUE_LENGTH] = res_buffer;
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ test_unit(void)
|
||||||
TEST_CHECK(inst2->valid_timestamps == (j > 0));
|
TEST_CHECK(inst2->valid_timestamps == (j > 0));
|
||||||
|
|
||||||
DEBUG_LOG("response 2->1");
|
DEBUG_LOG("response 2->1");
|
||||||
process_response(inst1, 1, 1, 1, 1);
|
proc_response(inst1, 1, 1, 1, 1);
|
||||||
|
|
||||||
packet_queue[(j * 2 + 1) % PACKET_QUEUE_LENGTH] = res_buffer;
|
packet_queue[(j * 2 + 1) % PACKET_QUEUE_LENGTH] = res_buffer;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue