Fix for RTEMS NTP sync issue
This commit is contained in:
@@ -13,6 +13,14 @@
|
||||
|
||||
<!-- Insert new items immediately below here ... -->
|
||||
|
||||
<h3>RTEMS NTP Support Issue</h3>
|
||||
|
||||
<p>On RTEMS the NTP Time Provider could in some circumstances get out of sync
|
||||
with the server because the osdNTPGet() code wasn't clearing its input socket
|
||||
before sending out a new request. This
|
||||
(<a href="https://bugs.launchpad.net/bugs/1549908">Launchpad bug 1549908</a>)
|
||||
has now been fixed.</p>
|
||||
|
||||
<h3>CALC engine bitwise operator fixes</h3>
|
||||
|
||||
<p>The bitwise operators in the CALC engine have been modified to work properly
|
||||
@@ -21,7 +29,7 @@ back-porting some earlier changes from the 3.15 branch, and fixes
|
||||
<a href="https://code.launchpad.net/bugs/1514520">Launchpad bug
|
||||
#1514520</a>.</p>
|
||||
|
||||
<h3>ipAddrToAsciiAsync.: don't try to join the daemon thread</h3>
|
||||
<h3>ipAddrToAsciiAsync.: Don't try to join the daemon thread</h3>
|
||||
|
||||
<p>On process exit, no longer try to stop the worker thread used by
|
||||
to make DNS lookups asynchronous.
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*
|
||||
* Author: W. Eric Norum
|
||||
*/
|
||||
#define __BSD_VISIBLE 1
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <epicsStdio.h>
|
||||
#include <rtems.h>
|
||||
@@ -40,8 +43,37 @@ void osdTimeRegister(void)
|
||||
|
||||
int osdNTPGet(struct timespec *ts)
|
||||
{
|
||||
static unsigned bequiet;
|
||||
ssize_t ret;
|
||||
|
||||
if (ntpSocket < 0)
|
||||
return -1;
|
||||
|
||||
/* rtems_bsdnet_get_ntp() will send an NTP request, then
|
||||
* call recvfrom() exactly once to process the expected reply.
|
||||
* Any leftovers in the socket buffer (ie. duplicates of
|
||||
* previous replies) will cause problems.
|
||||
* So flush out the socket buffer first.
|
||||
*/
|
||||
do {
|
||||
char junk[16];
|
||||
|
||||
ret = recvfrom(ntpSocket, junk, sizeof(junk), MSG_DONTWAIT, NULL, NULL);
|
||||
if (ret == -1 && errno == EAGAIN) {
|
||||
break;
|
||||
}
|
||||
else if (ret == -1) {
|
||||
if (!bequiet) {
|
||||
printf("osdNTPGet cleaner error: %s\n", strerror(errno));
|
||||
bequiet = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
bequiet = 0;
|
||||
}
|
||||
} while (ret > 0);
|
||||
|
||||
return rtems_bsdnet_get_ntp(ntpSocket, NULL, ts);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user