From: <gn...@us...> - 2012-03-07 19:12:47
|
Revision: 183 http://ptpd.svn.sourceforge.net/ptpd/?rev=183&view=rev Author: gnn Date: 2012-03-07 19:12:36 +0000 (Wed, 07 Mar 2012) Log Message: ----------- Clear two variables that were not being cleared on startup. Fix a bug where we couldn't accept any sort of negative delay. Now the delay is checked as an absolute value when the -M/-O flags are used. This helps when there is temporary interference on an interface. Modified Paths: -------------- trunk/src/dep/servo.c trunk/src/protocol.c Modified: trunk/src/dep/servo.c =================================================================== --- trunk/src/dep/servo.c 2012-03-01 18:37:13 UTC (rev 182) +++ trunk/src/dep/servo.c 2012-03-07 19:12:36 UTC (rev 183) @@ -108,11 +108,8 @@ /* todo: do all intermediate calculations on temp vars */ TimeInternal prev_meanPathDelay = ptpClock->meanPathDelay; - - ptpClock->char_last_msg='D'; - { //perform basic checks, using local variables only TimeInternal slave_to_master_delay; @@ -122,16 +119,25 @@ subTime(&slave_to_master_delay, &ptpClock->delay_req_receive_time, &ptpClock->delay_req_send_time); - if (slave_to_master_delay.nanoseconds < 0) { - INFO("updateDelay aborted, delay %d is negative\n", - slave_to_master_delay.nanoseconds); - return; - } + if (rtOpts->maxDelay) { /* If maxDelay is 0 then it's OFF */ + if ((slave_to_master_delay.nanoseconds < 0) && + (abs(slave_to_master_delay.nanoseconds) > rtOpts->maxDelay)) { + INFO("updateDelay aborted, delay (sec: %d ns: %d) " + "is negative\n", + slave_to_master_delay.seconds, + slave_to_master_delay.nanoseconds); + INFO("send (sec: %d ns: %d)\n ", + ptpClock->delay_req_send_time.seconds, + ptpClock->delay_req_send_time.nanoseconds); + INFO("recv (sec: %d n s: %d)\n", + ptpClock->delay_req_receive_time.seconds, + ptpClock->delay_req_receive_time.nanoseconds); + goto display; + } - if (rtOpts->maxDelay) { /* If maxDelay is 0 then it's OFF */ if (slave_to_master_delay.seconds && rtOpts->maxDelay) { INFO("updateDelay aborted, delay greater than 1" - " second."); + " second.\n"); msgDump(ptpClock); goto display; } @@ -325,7 +331,7 @@ if (rtOpts->maxDelay) { /* If maxDelay is 0 then it's OFF */ if (master_to_slave_delay.seconds && rtOpts->maxDelay) { INFO("updateOffset aborted, delay greater than 1" - " second."); + " second.\n"); msgDump(ptpClock); return; } Modified: trunk/src/protocol.c =================================================================== --- trunk/src/protocol.c 2012-03-01 18:37:13 UTC (rev 182) +++ trunk/src/protocol.c 2012-03-07 19:12:36 UTC (rev 183) @@ -248,6 +248,8 @@ ptpClock->waitingForDelayResp = FALSE; // FIXME: clear these vars inside initclock + clearTime(&ptpClock->delay_req_send_time); + clearTime(&ptpClock->delay_req_receive_time); clearTime(&ptpClock->pdelay_req_send_time); clearTime(&ptpClock->pdelay_req_receive_time); clearTime(&ptpClock->pdelay_resp_send_time); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |