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

Function ngp_shutdown

freebsd/netgraph/ng_pipe.c:912–930  ·  view source on GitHub ↗

* Shutdown processing * * This is tricky. If we have both a lower and upper hook, then we * probably want to extricate ourselves and leave the two peers * still linked to each other. Otherwise we should just shut down as * a normal node would. */

Source from the content-addressed store, hash-verified

910 * a normal node would.
911 */
912static int
913ngp_shutdown(node_p node)
914{
915 const priv_p priv = NG_NODE_PRIVATE(node);
916
917 if (priv->timer_scheduled)
918 ng_uncallout(&priv->timer, node);
919 if (priv->lower.hook && priv->upper.hook)
920 ng_bypass(priv->lower.hook, priv->upper.hook);
921 else {
922 if (priv->upper.hook != NULL)
923 ng_rmhook_self(priv->upper.hook);
924 if (priv->lower.hook != NULL)
925 ng_rmhook_self(priv->lower.hook);
926 }
927 NG_NODE_UNREF(node);
928 free(priv, M_NG_PIPE);
929 return (0);
930}
931
932/*
933 * Hook disconnection

Callers

nothing calls this directly

Calls 4

ng_uncalloutFunction · 0.70
ng_bypassFunction · 0.70
ng_rmhook_selfFunction · 0.70
freeFunction · 0.50

Tested by

no test coverage detected