MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_CheckTimers

Function sctp_CheckTimers

freebsd/netinet/libalias/alias_sctp.c:2471–2497  ·  view source on GitHub ↗

@ingroup Timer * @brief Check timer Q against current time * * Loop through each entry in the timer queue since the last time we processed * the timer queue until now (the current time). For each association in the * event list, we remove it from that position in the timer queue and check if * it has really expired. If so we: * - Log the timer expiry * - Remove the association from the NAT

Source from the content-addressed store, hash-verified

2469 * @param la Pointer to the relevant libalias instance
2470 */
2471void
2472sctp_CheckTimers(struct libalias *la)
2473{
2474 struct sctp_nat_assoc *assoc;
2475
2476 LIBALIAS_LOCK_ASSERT(la);
2477 while(la->timeStamp >= la->sctpNatTimer.loc_time) {
2478 while (!LIST_EMPTY(&la->sctpNatTimer.TimerQ[la->sctpNatTimer.cur_loc])) {
2479 assoc = LIST_FIRST(&la->sctpNatTimer.TimerQ[la->sctpNatTimer.cur_loc]);
2480 //SLIST_REMOVE_HEAD(&la->sctpNatTimer.TimerQ[la->sctpNatTimer.cur_loc], timer_Q);
2481 LIST_REMOVE(assoc, timer_Q);
2482 if (la->timeStamp >= assoc->exp) { /* state expired */
2483 SN_LOG(((assoc->state == SN_CL) ? (SN_LOG_DEBUG) : (SN_LOG_INFO)),
2484 logsctperror("Timer Expired", assoc->g_vtag, assoc->state, SN_TO_NODIR));
2485 RmSctpAssoc(la, assoc);
2486 freeGlobalAddressList(assoc);
2487 sn_free(assoc);
2488 } else {/* state not expired, reschedule timer*/
2489 sctp_AddTimeOut(la, assoc);
2490 }
2491 }
2492 /* Goto next location in the timer queue*/
2493 ++la->sctpNatTimer.loc_time;
2494 if (++la->sctpNatTimer.cur_loc >= SN_TIMER_QUEUE_SIZE)
2495 la->sctpNatTimer.cur_loc = 0;
2496 }
2497}
2498
2499/* ----------------------------------------------------------------------
2500 * LOGGING CODE

Callers 1

SctpAliasFunction · 0.85

Calls 4

logsctperrorFunction · 0.85
RmSctpAssocFunction · 0.85
freeGlobalAddressListFunction · 0.85
sctp_AddTimeOutFunction · 0.85

Tested by

no test coverage detected