mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Ethernet: fix calculation of T2 in DHCP
This commit is contained in:
parent
2b089e6b58
commit
50dff341f2
@ -94,14 +94,14 @@ int DhcpClass::request_DHCP_lease(){
|
|||||||
if(_dhcpLeaseTime == 0){
|
if(_dhcpLeaseTime == 0){
|
||||||
_dhcpLeaseTime = DEFAULT_LEASE;
|
_dhcpLeaseTime = DEFAULT_LEASE;
|
||||||
}
|
}
|
||||||
//calculate T1 & T2 if we didn't get it
|
// Calculate T1 & T2 if we didn't get it
|
||||||
if(_dhcpT1 == 0){
|
if(_dhcpT1 == 0){
|
||||||
//T1 should be 50% of _dhcpLeaseTime
|
// T1 should be 50% of _dhcpLeaseTime
|
||||||
_dhcpT1 = _dhcpLeaseTime >> 1;
|
_dhcpT1 = _dhcpLeaseTime >> 1;
|
||||||
}
|
}
|
||||||
if(_dhcpT2 == 0){
|
if(_dhcpT2 == 0){
|
||||||
//T2 should be 87.5% (7/8ths) of _dhcpLeaseTime
|
// T2 should be 87.5% (7/8ths) of _dhcpLeaseTime
|
||||||
_dhcpT2 = _dhcpT1 << 1;
|
_dhcpT2 = _dhcpLeaseTime - (_dhcpLeaseTime >> 3);
|
||||||
}
|
}
|
||||||
_renewInSec = _dhcpT1;
|
_renewInSec = _dhcpT1;
|
||||||
_rebindInSec = _dhcpT2;
|
_rebindInSec = _dhcpT2;
|
||||||
|
Loading…
Reference in New Issue
Block a user