dns timeout is part of udp

This commit is contained in:
Tomas Jakstas 2020-03-22 12:15:13 +02:00
parent b740822829
commit d2161a6717
2 changed files with 4 additions and 4 deletions

View File

@ -92,7 +92,7 @@ bool NTPClient::forceUpdate(uint16_t timeout) {
while(this->_udp->parsePacket() != 0)
this->_udp->flush();
this->sendNTPPacket(timeout >= 3000 ? 1500 : 500, 2);
this->sendNTPPacket();
// Wait till data is there or timeout...
int cb = 0;
@ -177,7 +177,7 @@ void NTPClient::setPoolServerName(const char* poolServerName) {
this->_poolServerName = poolServerName;
}
void NTPClient::sendNTPPacket(uint16_t dnsTimeout, uint8_t dnsRetries) {
void NTPClient::sendNTPPacket() {
// set all bytes in the buffer to 0
memset(this->_packetBuffer, 0, NTP_PACKET_SIZE);
// Initialize values needed to form NTP request
@ -195,7 +195,7 @@ void NTPClient::sendNTPPacket(uint16_t dnsTimeout, uint8_t dnsRetries) {
// all NTP fields have been given values, now
// you can send a packet requesting a timestamp:
if (this->_poolServerName) {
this->_udp->beginPacket(this->_poolServerName, 123, dnsTimeout, dnsRetries);
this->_udp->beginPacket(this->_poolServerName, 123);
} else {
this->_udp->beginPacket(this->_poolServerIP, 123);
}

View File

@ -25,7 +25,7 @@ class NTPClient {
byte _packetBuffer[NTP_PACKET_SIZE];
void sendNTPPacket(uint16_t dnsTimeout = 2000, uint8_t dnsRetries = 2);
void sendNTPPacket();
public:
NTPClient(UDP& udp);