We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b089e6 commit 50dff34Copy full SHA for 50dff34
libraries/Ethernet/src/Dhcp.cpp
@@ -94,14 +94,14 @@ int DhcpClass::request_DHCP_lease(){
94
if(_dhcpLeaseTime == 0){
95
_dhcpLeaseTime = DEFAULT_LEASE;
96
}
97
- //calculate T1 & T2 if we didn't get it
+ // Calculate T1 & T2 if we didn't get it
98
if(_dhcpT1 == 0){
99
- //T1 should be 50% of _dhcpLeaseTime
+ // T1 should be 50% of _dhcpLeaseTime
100
_dhcpT1 = _dhcpLeaseTime >> 1;
101
102
if(_dhcpT2 == 0){
103
- //T2 should be 87.5% (7/8ths) of _dhcpLeaseTime
104
- _dhcpT2 = _dhcpT1 << 1;
+ // T2 should be 87.5% (7/8ths) of _dhcpLeaseTime
+ _dhcpT2 = _dhcpLeaseTime - (_dhcpLeaseTime >> 3);
105
106
_renewInSec = _dhcpT1;
107
_rebindInSec = _dhcpT2;
0 commit comments