* 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. */
| 910 | * a normal node would. |
| 911 | */ |
| 912 | static int |
| 913 | ngp_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 |
nothing calls this directly
no test coverage detected