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

Function tcp_destroy

freebsd/netinet/tcp_subr.c:1245–1294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1243
1244#ifdef VIMAGE
1245static void
1246tcp_destroy(void *unused __unused)
1247{
1248 int n;
1249#ifdef TCP_HHOOK
1250 int error;
1251#endif
1252
1253 /*
1254 * All our processes are gone, all our sockets should be cleaned
1255 * up, which means, we should be past the tcp_discardcb() calls.
1256 * Sleep to let all tcpcb timers really disappear and cleanup.
1257 */
1258 for (;;) {
1259 INP_LIST_RLOCK(&V_tcbinfo);
1260 n = V_tcbinfo.ipi_count;
1261 INP_LIST_RUNLOCK(&V_tcbinfo);
1262 if (n == 0)
1263 break;
1264 pause("tcpdes", hz / 10);
1265 }
1266 tcp_hc_destroy();
1267 syncache_destroy();
1268 tcp_tw_destroy();
1269 in_pcbinfo_destroy(&V_tcbinfo);
1270 /* tcp_discardcb() clears the sack_holes up. */
1271 uma_zdestroy(V_sack_hole_zone);
1272 uma_zdestroy(V_tcpcb_zone);
1273
1274 /*
1275 * Cannot free the zone until all tcpcbs are released as we attach
1276 * the allocations to them.
1277 */
1278 tcp_fastopen_destroy();
1279
1280#ifdef TCP_HHOOK
1281 error = hhook_head_deregister(V_tcp_hhh[HHOOK_TCP_EST_IN]);
1282 if (error != 0) {
1283 printf("%s: WARNING: unable to deregister helper hook "
1284 "type=%d, id=%d: error %d returned\n", __func__,
1285 HHOOK_TYPE_TCP, HHOOK_TCP_EST_IN, error);
1286 }
1287 error = hhook_head_deregister(V_tcp_hhh[HHOOK_TCP_EST_OUT]);
1288 if (error != 0) {
1289 printf("%s: WARNING: unable to deregister helper hook "
1290 "type=%d, id=%d: error %d returned\n", __func__,
1291 HHOOK_TYPE_TCP, HHOOK_TCP_EST_OUT, error);
1292 }
1293#endif
1294}
1295VNET_SYSUNINIT(tcp, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH, tcp_destroy, NULL);
1296#endif
1297

Callers

nothing calls this directly

Calls 8

tcp_hc_destroyFunction · 0.85
syncache_destroyFunction · 0.85
tcp_tw_destroyFunction · 0.85
in_pcbinfo_destroyFunction · 0.85
uma_zdestroyFunction · 0.85
tcp_fastopen_destroyFunction · 0.85
hhook_head_deregisterFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected