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

Function ng_l2cap_con_unref

freebsd/netgraph/bluetooth/l2cap/ng_l2cap_misc.c:176–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174 */
175
176void
177ng_l2cap_con_unref(ng_l2cap_con_p con)
178{
179 con->refcnt --;
180
181 if (con->refcnt < 0)
182 panic(
183"%s: %s - con->refcnt < 0\n", __func__, NG_NODE_NAME(con->l2cap->node));
184
185 /*
186 * Set auto disconnect timer only if the following conditions are met:
187 * 1) we have no reference on the connection
188 * 2) connection is in OPEN state
189 * 3) it is an outgoing connection
190 * 4) disconnect timeout > 0
191 * 5) connection is not dying
192 */
193
194 if ((con->refcnt == 0) &&
195 (con->state == NG_L2CAP_CON_OPEN) &&
196 (con->flags & NG_L2CAP_CON_OUTGOING) &&
197 (con->l2cap->discon_timo > 0) &&
198 ((con->flags & NG_L2CAP_CON_DYING) == 0))
199 ng_l2cap_discon_timeout(con);
200} /* ng_l2cap_con_unref */
201
202/*
203 * Set auto disconnect timeout

Callers 1

ng_l2cap_free_chanFunction · 0.85

Calls 2

ng_l2cap_discon_timeoutFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected