From 2724d250165a395ea8bb8684bf4cbb51e633bbc7 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 31 Aug 1999 16:21:11 +0000 Subject: [PATCH] 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 --- src/db/drvTS.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/db/drvTS.c b/src/db/drvTS.c index 5dcef2afa..566f40d23 100644 --- a/src/db/drvTS.c +++ b/src/db/drvTS.c @@ -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);