mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
Ehternet: removed useless _lastCheck field in DHCP
it seems that _lastCheck, besides the name, was simply used as flag to detect if _secTimeout is initialized. Now the check is removed and _secTimeout is initalized in the proper place.
This commit is contained in:
parent
ce595ce818
commit
2b089e6b58
@ -14,7 +14,6 @@ int DhcpClass::beginWithDHCP(uint8_t *mac, unsigned long timeout, unsigned long
|
||||
_dhcpLeaseTime=0;
|
||||
_dhcpT1=0;
|
||||
_dhcpT2=0;
|
||||
_lastCheck=0;
|
||||
_timeout = timeout;
|
||||
_responseTimeout = responseTimeout;
|
||||
|
||||
@ -125,6 +124,7 @@ int DhcpClass::request_DHCP_lease(){
|
||||
_dhcpUdpSocket.stop();
|
||||
_dhcpTransactionId++;
|
||||
|
||||
_secTimeout = millis() + 1000;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -396,7 +396,7 @@ int DhcpClass::checkLease(){
|
||||
unsigned long now = millis();
|
||||
signed long snow = (long)now;
|
||||
int rc=DHCP_CHECK_NONE;
|
||||
if (_lastCheck != 0){
|
||||
|
||||
signed long factor;
|
||||
//calc how many ms past the timeout we are
|
||||
factor = snow - (long)_secTimeout;
|
||||
@ -435,12 +435,6 @@ int DhcpClass::checkLease(){
|
||||
reset_DHCP_lease();
|
||||
rc = 3 + request_DHCP_lease();
|
||||
}
|
||||
}
|
||||
else{
|
||||
_secTimeout = snow + 1000;
|
||||
}
|
||||
|
||||
_lastCheck = now;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,6 @@ private:
|
||||
uint32_t _dhcpT1, _dhcpT2;
|
||||
signed long _renewInSec;
|
||||
signed long _rebindInSec;
|
||||
signed long _lastCheck;
|
||||
unsigned long _timeout;
|
||||
unsigned long _responseTimeout;
|
||||
unsigned long _secTimeout;
|
||||
|
Loading…
x
Reference in New Issue
Block a user