fix
This commit is contained in:
@ -53,15 +53,15 @@ static void networkSntpEngine(void *handle) {
|
||||
switch (sntpState) {
|
||||
case SNTP_STATE_START:
|
||||
coloredMsg(LOG_BLUE, "nes, about to send");
|
||||
socket(SNTP_SOCK, Sn_MR_UDP, NTP_PORT, 0);
|
||||
retryCount = 0;
|
||||
uint8_t sockState = getSn_SR(SNTP_SOCK);
|
||||
if (sockState == SOCK_UDP) {
|
||||
uint8_t ntpAddr[4];
|
||||
if (! wizDnsQuery(config->ntpServer, ntpAddr)) {
|
||||
coloredMsg(LOG_BLUE, "nes, failed to resolve ntp server");
|
||||
sntpState = SNTP_STATE_ERROR;
|
||||
} else {
|
||||
socket(SNTP_SOCK, Sn_MR_UDP, NTP_PORT, 0);
|
||||
retryCount = 0;
|
||||
uint8_t sockState = getSn_SR(SNTP_SOCK);
|
||||
if (sockState == SOCK_UDP) {
|
||||
ntpMsg_t ntpMsg;
|
||||
memset(&ntpMsg, 0, sizeof(ntpMsg));
|
||||
ntpMsg.li_vn_mode = SEND_LI_VN_MODE;
|
||||
@ -69,7 +69,6 @@ static void networkSntpEngine(void *handle) {
|
||||
coloredMsg(LOG_BLUE, "nes, sent");
|
||||
sntpState = SNTP_STATE_RECV;
|
||||
schAdd(networkSntpEngine, NULL, 1000, 0);
|
||||
}
|
||||
} else {
|
||||
coloredMsg(LOG_BLUE, "nes, socket in unexpected state: %d", sockState);
|
||||
sntpState = SNTP_STATE_ERROR;
|
||||
|
Reference in New Issue
Block a user