Generalize the rx idle dead time support to include client connections,
authorNickolai Zeldovich <kolya@mit.edu>
Mon, 13 Jan 2003 20:24:34 +0000 (20:24 +0000)
committerNickolai Zeldovich <kolya@mit.edu>
Mon, 13 Jan 2003 20:24:34 +0000 (20:24 +0000)
in addition to server connections.  This will eventually be used by the
AFS client to better time out non-replying servers.

src/rx/rx.c
src/rx/rx.h

index ab1dc0c..ea76368 100644 (file)
@@ -2275,6 +2275,7 @@ struct rx_connection *rxi_FindConnection(osi_socket socket,
        conn->nSpecific = 0;
        conn->specific = NULL;
        rx_SetConnDeadTime(conn, service->connDeadTime);
+       rx_SetConnIdleDeadTime(conn, service->idleDeadTime);
        /* Notify security object of the new connection */
        RXS_NewConnection(conn->securityObject, conn);
        /* XXXX Connection timeout? */
@@ -5108,7 +5109,6 @@ int rxi_CheckCall(register struct rx_call *call)
 #endif /* RX_ENABLE_LOCKS */
 {
     register struct rx_connection *conn = call->conn;
-    register struct rx_service *tservice;
     afs_uint32 now;
     afs_uint32 deadTime;
 
@@ -5155,10 +5155,8 @@ int rxi_CheckCall(register struct rx_call *call)
          * attached process can die reasonably gracefully. */
     }
     /* see if we have a non-activity timeout */
-    tservice = conn->service;
-    if ((conn->type == RX_SERVER_CONNECTION) && call->startWait
-       && tservice->idleDeadTime
-       && ((call->startWait + tservice->idleDeadTime) < now)) {
+    if (call->startWait && conn->idleDeadTime
+       && ((call->startWait + conn->idleDeadTime) < now)) {
        if (call->state == RX_STATE_ACTIVE) {
            rxi_CallError(call, RX_CALL_TIMEOUT);
            return -1;
index cc27a46..4027d94 100644 (file)
@@ -162,8 +162,9 @@ int ntoh_syserr_conv(int error);
 /* Enable or disable asymmetric client checking for a service */
 #define rx_SetCheckReach(service, x) ((service)->checkReach = (x))
 
-/* Set connection hard timeout for a connection */
+/* Set connection hard and idle timeouts for a connection */
 #define rx_SetConnHardDeadTime(conn, seconds) ((conn)->hardDeadTime = (seconds))
+#define rx_SetConnIdleDeadTime(conn, seconds) ((conn)->idleDeadTime = (seconds))
 
 /* Set the overload threshold and the overload error */
 #define rx_SetBusyThreshold(threshold, code) (rx_BusyThreshold=(threshold),rx_BusyError=(code))
@@ -257,6 +258,7 @@ struct rx_connection {
     int        lastSendTime;               /* Last send time for this connection */
     u_short secondsUntilDead;      /* Maximum silence from peer before RX_CALL_DEAD */
     u_short hardDeadTime;          /* hard max for call execution */
+    u_short idleDeadTime;          /* max time a call can be idle (no data) */
     u_char ackRate;                 /* how many packets between ack requests */
     u_char makeCallWaiters;         /* how many rx_NewCalls are waiting */
     int nSpecific;                 /* number entries in specific data */