From 48aca4a605fa46b677a50687d6ea911fbe7d2032 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 6 Oct 2010 17:24:02 -0500 Subject: [PATCH] RX: Adjust all timeouts for RTT Previously only the deadTime RX network timeout was getting adjusted for the peer's rtt and rtt_dev values. Do this for the idle and hard timeouts as well, since a higher RTT is going to make everything potentially take longer. Change-Id: I1aabcfd19656d5130eaa0e41e0974b3b4427add1 Reviewed-on: http://gerrit.openafs.org/2967 Tested-by: BuildBot Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- src/rx/rx.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index ff4b564..47f540a 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -5964,7 +5964,8 @@ rxi_CheckCall(struct rx_call *call) { struct rx_connection *conn = call->conn; afs_uint32 now; - afs_uint32 deadTime; + afs_uint32 deadTime, idleDeadTime = 0, hardDeadTime = 0; + afs_uint32 fudgeFactor; int cerror = 0; int newmtu = 0; @@ -5976,11 +5977,11 @@ rxi_CheckCall(struct rx_call *call) return 0; } #endif - /* dead time + RTT + 8*MDEV, rounded up to next second. */ - deadTime = - (((afs_uint32) conn->secondsUntilDead << 10) + - ((afs_uint32) conn->peer->rtt >> 3) + - ((afs_uint32) conn->peer->rtt_dev << 1) + 1023) >> 10; + /* RTT + 8*MDEV, rounded up to the next second. */ + fudgeFactor = (((afs_uint32) conn->peer->rtt >> 3) + + ((afs_uint32) conn->peer->rtt_dev << 1) + 1023) >> 10; + + deadTime = conn->secondsUntilDead + fudgeFactor; now = clock_Sec(); /* These are computed to the second (+- 1 second). But that's * good enough for these values, which should be a significant @@ -6041,25 +6042,35 @@ rxi_CheckCall(struct rx_call *call) * to pings; active calls are simply flagged in error, so the * attached process can die reasonably gracefully. */ } + + if (conn->idleDeadTime) { + idleDeadTime = conn->idleDeadTime + fudgeFactor; + } + /* see if we have a non-activity timeout */ - if (call->startWait && conn->idleDeadTime - && ((call->startWait + conn->idleDeadTime) < now) && + if (call->startWait && idleDeadTime + && ((call->startWait + idleDeadTime) < now) && (call->flags & RX_CALL_READER_WAIT)) { if (call->state == RX_STATE_ACTIVE) { cerror = RX_CALL_TIMEOUT; goto mtuout; } } - if (call->lastSendData && conn->idleDeadTime && (conn->idleDeadErr != 0) - && ((call->lastSendData + conn->idleDeadTime) < now)) { + if (call->lastSendData && idleDeadTime && (conn->idleDeadErr != 0) + && ((call->lastSendData + idleDeadTime) < now)) { if (call->state == RX_STATE_ACTIVE) { cerror = conn->idleDeadErr; goto mtuout; } } + + if (hardDeadTime) { + hardDeadTime = conn->hardDeadTime + fudgeFactor; + } + /* see if we have a hard timeout */ - if (conn->hardDeadTime - && (now > (conn->hardDeadTime + call->startTime.sec))) { + if (hardDeadTime + && (now > (hardDeadTime + call->startTime.sec))) { if (call->state == RX_STATE_ACTIVE) rxi_CallError(call, RX_CALL_TIMEOUT); return -1; -- 1.9.4