From: Simon Wilkinson Date: Fri, 26 Oct 2012 14:37:52 +0000 (+0100) Subject: rx: Move transmit queue clearing X-Git-Tag: upstream/1.8.0_pre1^2~1859 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=9607d0e7993f3dee7f70ae747ea9d0b8ba1404af;p=packages%2Fo%2Fopenafs.git 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 --- diff --git a/src/rx/rx.c b/src/rx/rx.c index 84ffd7b72..bb3a852f0 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;