mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-18 18:57:46 -04:00
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:
parent
d95624c5d6
commit
5003d17fed
1 changed files with 17 additions and 10 deletions
|
@ -488,18 +488,25 @@ BaseType_t xGivingUp = pdFALSE;
|
||||||
|
|
||||||
case eLeasedAddress :
|
case eLeasedAddress :
|
||||||
|
|
||||||
/* Resend the request at the appropriate time to renew the lease. */
|
if( FreeRTOS_IsNetworkUp() )
|
||||||
prvCreateDHCPSocket();
|
|
||||||
|
|
||||||
if( xDHCPData.xDHCPSocket != NULL )
|
|
||||||
{
|
{
|
||||||
xDHCPData.xDHCPTxTime = xTaskGetTickCount();
|
/* Resend the request at the appropriate time to renew the lease. */
|
||||||
xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;
|
prvCreateDHCPSocket();
|
||||||
prvSendDHCPRequest( );
|
|
||||||
xDHCPData.eDHCPState = eWaitingAcknowledge;
|
|
||||||
|
|
||||||
/* From now on, we should be called more often */
|
if( xDHCPData.xDHCPSocket != NULL )
|
||||||
vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );
|
{
|
||||||
|
xDHCPData.xDHCPTxTime = xTaskGetTickCount();
|
||||||
|
xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;
|
||||||
|
prvSendDHCPRequest();
|
||||||
|
xDHCPData.eDHCPState = eWaitingAcknowledge;
|
||||||
|
|
||||||
|
/* From now on, we should be called more often */
|
||||||
|
vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vIPReloadDHCPTimer( pdMS_TO_TICKS( dhcpINITIAL_DHCP_TX_PERIOD ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue