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