Rx: When call receive is done, send ack all packet
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 30 Sep 2010 14:48:58 +0000 (10:48 -0400)
committerDerrick Brashear <shadow@dementia.org>
Sat, 2 Oct 2010 17:17:34 +0000 (10:17 -0700)
When all of the packets for a call have been received,
immediately send an ack all packet to the peer.  This permits
the peer to free the contents of the transmit queue and cancel
all pending resend events.

Change-Id: Ic06ccaca6f0c5e2f770c5c45c84f7fc155207bcf
Reviewed-on: http://gerrit.openafs.org/2871
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/rx/rx.c

index a0363b0..aad1009 100644 (file)
@@ -3737,8 +3737,17 @@ rxi_ReceiveDataPacket(struct rx_call *call,
      * Send an ack when requested by the peer, or once every
      * rxi_SoftAckRate packets until the last packet has been
      * received. Always send a soft ack for the last packet in
-     * the server's reply. */
-    if (ackNeeded) {
+     * the server's reply.
+     *
+     * If we have received all of the packets for the call
+     * immediately send an RX_PACKET_TYPE_ACKALL packet so that
+     * the peer can empty its packet queue and cancel all resend
+     * events.
+     */
+    if (call->flags & RX_CALL_RECEIVE_DONE) {
+        rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY);
+        rxi_AckAll(NULL, call, 0);
+    } else if (ackNeeded) {
        rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY);
        np = rxi_SendAck(call, np, serial, ackNeeded, istack);
     } else if (call->nSoftAcks > (u_short) rxi_SoftAckRate) {
@@ -3762,8 +3771,6 @@ rxi_ReceiveDataPacket(struct rx_call *call,
            call->delayedAckEvent =
                rxevent_PostNow(&when, &now, rxi_SendDelayedAck, call, 0);
        }
-    } else if (call->flags & RX_CALL_RECEIVE_DONE) {
-       rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY);
     }
 
     return np;