| 174 | */ |
| 175 | |
| 176 | void |
| 177 | ng_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 |
no test coverage detected