fixed bug where time sync UDP client was getting in a state where

it was using the response from the previous request, and ending
up setting the time 10 seconds back
This commit is contained in:
Jeff Hill
1999-08-31 16:21:11 +00:00
parent 0166de83da
commit 2724d25016

View File

@@ -12,6 +12,9 @@ of this distribution.
**********************************************************************/
/*
* $Log$
* Revision 1.28.2.1 1999/07/09 14:04:03 mrk
* encorporate latest SAFE (hop[efully) changes on 09JUL99
*
* Revision 1.29 1999/02/11 17:02:34 jhill
* removed potential infinite recursion from tsForceSoftSync()
*
@@ -1828,6 +1831,27 @@ static long TSgetData(char* buf, int buf_size, int soc,
struct timeval timeOut;
struct timespec send_time,recv_time;
/*
* joh 08-26-99
* added this code which removes responses laying around from
* requests made in the past that timed out
*/
Debug(8,"removing stale responses %s\n", "");
while (1) {
int status;
status = ioctl (soc, FIONREAD, (int) &mlen);
if (status<0) {
Debug(1,"ioctl FIONREAD failed because \"%s\"?\n", strerror(errno));
break;
}
else if (mlen==0) {
break;
}
Debug(1,"removing stale response of %d bytes\n", mlen);
recvfrom(soc,buf,buf_size,0,from_sin,&flen);
}
/* convert millisecond time out to seconds/microseconds */
s=TSdata.time_out/1000; us=(TSdata.time_out-(s*1000))*1000;
Debug(6,"time_out Second=%lu\n",s);