X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/e3027f41d0120b4278cca462f397b6619dcd9ac5..0b4e3aa066abc0728aacb4bbeb86f53f9737156e:/bsd/netat/atp_misc.c diff --git a/bsd/netat/atp_misc.c b/bsd/netat/atp_misc.c index b332e1ebf..0bc9447b3 100644 --- a/bsd/netat/atp_misc.c +++ b/bsd/netat/atp_misc.c @@ -145,38 +145,53 @@ l_notify: void atp_free(trp) register struct atp_trans *trp; -{ +{ register struct atp_state *atp; register int i; int s; dPrintf(D_M_ATP_LOW, D_L_TRACE, ("atp_free: freeing trp 0x%x\n", (u_int) trp)); - ATDISABLE(s, atpgen_lock); - if (trp->tr_tmo_func) - atp_untimout(atp_req_timeout, trp); - atp = trp->tr_queue; - ATP_Q_REMOVE(atp->atp_trans_wait, trp, tr_list); + ATDISABLE(s, atpgen_lock); - if (trp->tr_xmt) { - gbuf_freem(trp->tr_xmt); - trp->tr_xmt = NULL; + if (trp->tr_state == TRANS_ABORTING) { + ATP_Q_REMOVE(atp_trans_abort, trp, tr_list); + trp->tr_state = TRANS_DONE; } - for (i = 0; i < 8; i++) { - if (trp->tr_rcv[i]) { - gbuf_freem(trp->tr_rcv[i]); - trp->tr_rcv[i] = NULL; + else { + if (trp->tr_tmo_func) + atp_untimout(atp_req_timeout, trp); + + atp = trp->tr_queue; + ATP_Q_REMOVE(atp->atp_trans_wait, trp, tr_list); + + if (trp->tr_xmt) { + gbuf_freem(trp->tr_xmt); + trp->tr_xmt = NULL; + } + for (i = 0; i < 8; i++) { + if (trp->tr_rcv[i]) { + gbuf_freem(trp->tr_rcv[i]); + trp->tr_rcv[i] = NULL; + } + } + if (trp->tr_bdsp) { + gbuf_freem(trp->tr_bdsp); + trp->tr_bdsp = NULL; + } + + if (trp->tr_rsp_wait) { + trp->tr_state = TRANS_ABORTING; + ATP_Q_APPEND(atp_trans_abort, trp, tr_list); + thread_wakeup(&trp->tr_event); + ATENABLE(s, atpgen_lock); + return; } } - if (trp->tr_bdsp) { - gbuf_freem(trp->tr_bdsp); - trp->tr_bdsp = NULL; - } - + ATENABLE(s, atpgen_lock); atp_trans_free(trp); - } /* atp_free */