Commit 714abe20 authored by Aurelio Colosimo's avatar Aurelio Colosimo

master: save sync_time when sending, and immediately issue a followup

Very similar to commit 04a4e74c.
In the ptpd-2.1.0 implementation, the sync_time was read when
it was read back (and then a follow up was sent), because of
the multicast sending on udp. This is not acceptable if we are in
ethernet mode.
parent 595950e2
......@@ -339,17 +339,6 @@ int st_com_master_handle_announce(struct pp_instance *ppi, unsigned char *buf,
int st_com_master_handle_sync(struct pp_instance *ppi, unsigned char *buf,
int len)
{
TimeInternal *time;
if (len < PP_SYNC_LENGTH)
return -1;
if (!ppi->is_from_self)
return 0;
time = &ppi->last_rcv_time;
/* Add latency */
add_TimeInternal(time, time, &OPTS(ppi)->outbound_latency);
msg_issue_followup(ppi, time);
/* No more used: follow up is sent right after the corresponding sync */
return 0;
}
......@@ -10,6 +10,7 @@
int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
TimeInternal *time;
TimeInternal *time_snt;
TimeInternal req_rec_tstamp;
TimeInternal correction_field;
TimeInternal resp_orig_tstamp;
......@@ -37,6 +38,11 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
PP_VPRINTF("event SYNC_INTERVAL_TIMEOUT_EXPIRES\n");
if (msg_issue_sync(ppi) < 0)
goto failure;
time_snt = &ppi->last_snt_time;
add_TimeInternal(time_snt, time_snt, &OPTS(ppi)->outbound_latency);
if (msg_issue_followup(ppi, time_snt))
goto failure;
}
if (pp_timer_expired(ppi->timers[PP_TIMER_ANN_INTERVAL])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment