/* Enable the keepalive timer and set the timeout value. */
VOID TcpSetKeepaliveTimer(IN OUT TCP_CB *Tcb)
/* Enable the keepalive timer and set the timeout value. */
VOID TcpSetKeepaliveTimer(IN OUT TCP_CB *Tcb)
{
  if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_KEEPALIVE)) {
    return;
  }
  if (!TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_KEEPALIVE) ||
      (Tcb->Idle < Tcb->KeepAliveIdle)
      )
  {
    TcpSetTimer (Tcb, TCP_TIMER_KEEPALIVE, Tcb->KeepAliveIdle);
    Tcb->KeepAliveProbes = 0;
  } else {
    TcpSetTimer (Tcb, TCP_TIMER_KEEPALIVE, Tcb->KeepAlivePeriod);
  }
}