int ng_hci_command_untimeout(ng_hci_unit_p unit) { if (!(unit->state & NG_HCI_UNIT_COMMAND_PENDING)) panic( "%s: %s - No command timeout!\n", __func__, NG_NODE_NAME(unit->node)); if (ng_uncallout(&unit->cmd_timo, unit->node) == 0) return (ETIMEDOUT); unit->state &= ~NG_HCI_UNIT_COMMAND_PENDING; return (0); } /* ng_hci_command_untimeout */
int ng_hci_con_untimeout(ng_hci_unit_con_p con) { if (!(con->flags & NG_HCI_CON_TIMEOUT_PENDING)) panic( "%s: %s - No connection timeout!\n", __func__, NG_NODE_NAME(con->unit->node)); if (ng_uncallout(&con->con_timo, con->unit->node) == 0) return (ETIMEDOUT); con->flags &= ~NG_HCI_CON_TIMEOUT_PENDING; return (0); } /* ng_hci_con_untimeout */
/* * Hook disconnection * For this type, removal of any link except "debug" destroys the node. */ static int nglmi_disconnect(hook_p hook) { const sc_p sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); /* OK to remove debug hook(s) */ if (NG_HOOK_PRIVATE(hook) == NULL) return (0); /* Stop timer if it's currently active */ if (sc->flags & SCF_CONNECTED) ng_uncallout(&sc->handle, sc->node); /* Self-destruct */ if (NG_NODE_IS_VALID(NG_HOOK_NODE(hook))) ng_rmnode_self(NG_HOOK_NODE(hook)); return (0); }