FreeRTOS+TCP : renewing DHCP lease while network is down (#53)

Co-authored-by: Hein Tibosch <hein@htibosch.net>
Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com>
This commit is contained in:
Hein Tibosch
2020-05-06 14:16:56 -04:00
committed by GitHub
parent d95624c5d6
commit 5003d17fed

View File

@ -488,6 +488,8 @@ BaseType_t xGivingUp = pdFALSE;
case eLeasedAddress : case eLeasedAddress :
if( FreeRTOS_IsNetworkUp() )
{
/* Resend the request at the appropriate time to renew the lease. */ /* Resend the request at the appropriate time to renew the lease. */
prvCreateDHCPSocket(); prvCreateDHCPSocket();
@ -495,12 +497,17 @@ BaseType_t xGivingUp = pdFALSE;
{ {
xDHCPData.xDHCPTxTime = xTaskGetTickCount(); xDHCPData.xDHCPTxTime = xTaskGetTickCount();
xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD; xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;
prvSendDHCPRequest( ); prvSendDHCPRequest();
xDHCPData.eDHCPState = eWaitingAcknowledge; xDHCPData.eDHCPState = eWaitingAcknowledge;
/* From now on, we should be called more often */ /* From now on, we should be called more often */
vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD ); vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );
} }
}
else
{
vIPReloadDHCPTimer( pdMS_TO_TICKS( dhcpINITIAL_DHCP_TX_PERIOD ) );
}
break; break;
case eNotUsingLeasedAddress: case eNotUsingLeasedAddress: