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

Function expire_callout

freebsd/net/route/route_temporal.c:83–116  ·  view source on GitHub ↗

* Per-rnh callout function traversing the tree and deleting * expired routes. Calculates next callout run by looking at * the rt_expire time for the remaining temporal routes. */

Source from the content-addressed store, hash-verified

81 * the rt_expire time for the remaining temporal routes.
82 */
83static void
84expire_callout(void *arg)
85{
86 struct rib_head *rnh;
87 time_t next_expire;
88 int seconds;
89
90 rnh = (struct rib_head *)arg;
91
92 CURVNET_SET(rnh->rib_vnet);
93 next_expire = 0;
94
95 rib_walk_del(rnh->rib_fibnum, rnh->rib_family, expire_route,
96 (void *)&next_expire, 1);
97
98 RIB_WLOCK(rnh);
99 if (next_expire > 0) {
100 seconds = (next_expire - time_uptime);
101 if (seconds < 0)
102 seconds = 0;
103 callout_reset_sbt(&rnh->expire_callout, SBT_1S * seconds,
104 SBT_1MS * 500, expire_callout, rnh, 0);
105 rnh->next_expire = next_expire;
106 } else {
107 /*
108 * Before resetting next_expire, check that tmproutes_update()
109 * has not kicked in and scheduled another invocation.
110 */
111 if (callout_pending(&rnh->expire_callout) == 0)
112 rnh->next_expire = 0;
113 }
114 RIB_WUNLOCK(rnh);
115 CURVNET_RESTORE();
116}
117
118/*
119 * Function responsible for updating the time of the next calllout

Callers

nothing calls this directly

Calls 1

rib_walk_delFunction · 0.85

Tested by

no test coverage detected