From 9607d0e7993f3dee7f70ae747ea9d0b8ba1404af Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 26 Oct 2012 15:37:52 +0100 Subject: [PATCH] rx: Move transmit queue clearing When the client receives a data packet from the server, it means that the server has completed processing the client's request. This, in turn, implies that the transmit queue can be cleared. However, we were doing this with every incoming data packet. Move the transmit queue clearing to the code which handles the rest of the data packet, and make the function only run if the transmit queue is non-empty. Now that there's no client specific logic in the ReceiveCall section, clean up this code to reduce duplication. Change-Id: Ia4f9024720c676cbcc6d8426d4b94a0acded20bc Reviewed-on: http://gerrit.openafs.org/8301 Reviewed-by: Jeffrey Altman Tested-by: BuildBot --- src/rx/rx.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index 84ffd7b..bb3a852 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -3534,23 +3534,14 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, } } - if (type == RX_SERVER_CONNECTION) { + if (type == RX_SERVER_CONNECTION) call = rxi_ReceiveServerCall(socket, np, conn); - if (call == NULL) { - putConnection(conn); - return np; - } - } else { + else call = rxi_ReceiveClientCall(np, conn); - if (call == NULL) { - putConnection(conn); - return np; - } - /* If we're receiving the response, then all transmit packets are - * implicitly acknowledged. Get rid of them. */ - if (np->header.type == RX_PACKET_TYPE_DATA) - rxi_AckAllInTransmitQueue(call); + if (call == NULL) { + putConnection(conn); + return np; } osirx_AssertMine(&call->lock, "rxi_ReceivePacket middle"); @@ -3560,6 +3551,11 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, /* Now do packet type-specific processing */ switch (np->header.type) { case RX_PACKET_TYPE_DATA: + /* If we're a client, and receiving a response, then all the packets + * we transmitted packets are implicitly acknowledged. */ + if (type == RX_CLIENT_CONNECTION && !opr_queue_IsEmpty(&call->tq)) + rxi_AckAllInTransmitQueue(call); + np = rxi_ReceiveDataPacket(call, np, 1, socket, host, port, tnop, newcallp); break; -- 1.9.4