From a72eea6bb1758678d25528cd1ab9b439ade2f844 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 25 Sep 2008 18:21:15 +0000 Subject: [PATCH] rx-clear-queues-correctly-20080925 LICENSE IPL10 don't potentially leak packets by leaving them behind and initing queues; in fact, if you are cleaning up there is no need to init queues anyway. --- src/rx/rx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index b24798440..65d6c51f6 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -1281,7 +1281,7 @@ rx_NewCall(register struct rx_connection *conn) MUTEX_ENTER(&call->lock); rxi_WaitforTQBusy(call); if (call->flags & RX_CALL_TQ_CLEARME) { - rxi_ClearTransmitQueue(call, 0); + rxi_ClearTransmitQueue(call, 1); queue_Init(&call->tq); } MUTEX_EXIT(&call->lock); @@ -2233,7 +2233,7 @@ rxi_NewCall(register struct rx_connection *conn, register int channel) #ifdef AFS_GLOBAL_RXLOCK_KERNEL /* Now, if TQ wasn't cleared earlier, do it now. */ if (call->flags & RX_CALL_TQ_CLEARME) { - rxi_ClearTransmitQueue(call, 0); + rxi_ClearTransmitQueue(call, 1); queue_Init(&call->tq); } #endif /* AFS_GLOBAL_RXLOCK_KERNEL */ @@ -4636,7 +4636,6 @@ rxi_ResetCall(register struct rx_call *call, register int newcall) MUTEX_EXIT(&peer->peer_lock); flags = call->flags; - rxi_ClearReceiveQueue(call); #ifdef AFS_GLOBAL_RXLOCK_KERNEL if (flags & RX_CALL_TQ_BUSY) { call->flags = RX_CALL_TQ_CLEARME | RX_CALL_TQ_BUSY; @@ -4644,8 +4643,8 @@ rxi_ResetCall(register struct rx_call *call, register int newcall) } else #endif /* AFS_GLOBAL_RXLOCK_KERNEL */ { - rxi_ClearTransmitQueue(call, 0); - queue_Init(&call->tq); + rxi_ClearTransmitQueue(call, 1); + /* why init the queue if you just emptied it? queue_Init(&call->tq); */ if (call->tqWaiters || (flags & RX_CALL_TQ_WAIT)) { dpf(("rcall %x has %d waiters and flags %d\n", call, call->tqWaiters, call->flags)); } @@ -4659,7 +4658,9 @@ rxi_ResetCall(register struct rx_call *call, register int newcall) call->tqWaiters--; } } - queue_Init(&call->rq); + + rxi_ClearReceiveQueue(call); + /* why init the queue if you just emptied it? queue_Init(&call->rq); */ call->error = 0; call->twind = call->conn->twind[call->channel]; call->rwind = call->conn->rwind[call->channel]; -- 2.39.5