Enable the keepalive timer and set the timeout value. @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance. **/
| 450 | |
| 451 | **/ |
| 452 | VOID |
| 453 | TcpSetKeepaliveTimer ( |
| 454 | IN OUT TCP_CB *Tcb |
| 455 | ) |
| 456 | { |
| 457 | if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_KEEPALIVE)) { |
| 458 | return ; |
| 459 | |
| 460 | } |
| 461 | |
| 462 | // |
| 463 | // Set the timer to KeepAliveIdle if either |
| 464 | // 1. the keepalive timer is off |
| 465 | // 2. The keepalive timer is on, but the idle |
| 466 | // is less than KeepAliveIdle, that means the |
| 467 | // connection is alive since our last probe. |
| 468 | // |
| 469 | if (!TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_KEEPALIVE) || |
| 470 | (Tcb->Idle < Tcb->KeepAliveIdle) |
| 471 | ) { |
| 472 | |
| 473 | TcpSetTimer (Tcb, TCP_TIMER_KEEPALIVE, Tcb->KeepAliveIdle); |
| 474 | Tcb->KeepAliveProbes = 0; |
| 475 | |
| 476 | } else { |
| 477 | |
| 478 | TcpSetTimer (Tcb, TCP_TIMER_KEEPALIVE, Tcb->KeepAlivePeriod); |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | /** |
| 483 | Heart beat timer handler. |
no test coverage detected