changes
This commit is contained in:
@ -14,12 +14,13 @@ static t_seconds seconds = { .seconds = 0, .missedUpdates = 0, .valid = false };
|
||||
static t_configBlock *config;
|
||||
|
||||
|
||||
|
||||
static void networkSecondsHandler(void *handle) {
|
||||
static bool tryAgain = false;
|
||||
|
||||
seconds.seconds += 1;
|
||||
|
||||
if (! seconds.valid) {
|
||||
if (! seconds.valid && isNetworkAvailable()) {
|
||||
coloredMsg(LOG_YELLOW, "nsh, initially querying time");
|
||||
uint64_t tmpSeconds = networkSntpQuery();
|
||||
if (tmpSeconds != 0) {
|
||||
|
@ -90,6 +90,7 @@ void networkSntpEngine(void *handle) {
|
||||
if (sockState == SOCK_UDP) {
|
||||
memset(&(localHandle->ntpMsg), 0, sizeof(localHandle->ntpMsg));
|
||||
localHandle->ntpMsg.li_vn_mode = SEND_LI_VN_MODE;
|
||||
localHandle->ntpMsg.xmt_l = 1;
|
||||
sendto(SNTP_SOCK, (uint8_t*)(&(localHandle->ntpMsg)),
|
||||
sizeof(localHandle->ntpMsg), localHandle->ntpAddr, NTP_PORT);
|
||||
coloredMsg(LOG_BLUE, "nes, sent");
|
||||
@ -209,6 +210,10 @@ int8_t networkUdpSend(char *hostname, uint16_t port, uint8_t *buf, uint16_t bufL
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool isNetworkAvailable() {
|
||||
return wizIsNetworkAvailable();
|
||||
}
|
||||
|
||||
void networkImplInit() {
|
||||
config = getConfig();
|
||||
wizInit();
|
||||
|
@ -33,7 +33,7 @@ extern const uint8_t DNS_SOCK;
|
||||
|
||||
static bool networkAvailable = false;
|
||||
|
||||
bool isNetworkAvailable() {
|
||||
bool wizIsNetworkAvailable() {
|
||||
return networkAvailable;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user