/* Update the timer status and the next expire time according to the timers to expire in a specific future time slot. */
VOID TcpUpdateTimer(IN OUT TCP_CB *Tcb)
/* Update the timer status and the next expire time according to the timers to expire in a specific future time slot. */
VOID TcpUpdateTimer(IN OUT TCP_CB *Tcb)
{
  UINT16  Index;
  Tcb->NextExpire = TCP_EXPIRE_TIME;
  TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_TIMER_ON);
  for (Index = 0; Index < TCP_TIMER_NUMBER; Index++) {
    if (TCP_TIMER_ON (Tcb->EnabledTimer, Index) &&
        TCP_TIME_LT (Tcb->Timer[Index], mTcpTick + Tcb->NextExpire)
        )
    {
      Tcb->NextExpire = TCP_SUB_TIME (Tcb->Timer[Index], mTcpTick);
      TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_TIMER_ON);
    }
  }
}