]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Clean up code in rxi_FindConnection.
authorNickolai Zeldovich <kolya@mit.edu>
Thu, 14 Nov 2002 22:19:50 +0000 (22:19 +0000)
committerGarry Zacheiss <zacheiss@mit.edu>
Thu, 14 Nov 2002 22:19:50 +0000 (22:19 +0000)
(cherry picked from commit 82523baf9f76eca38fc4856f52bc7cdabddf14b3)

src/rx/rx.c

index dba5ddd7cfcb4b3699ce6dd47861e84228f9c979..56fd9579de769e90b5a732e74b1e86edba21084d 100644 (file)
@@ -2257,7 +2257,6 @@ rxi_FindConnection(socket, host, port, serviceId, cid,
 {
     int hashindex, flag;
     register struct rx_connection *conn;
-    struct rx_peer *peer;
     hashindex = CONN_HASH(host, port, cid, epoch, type);
     MUTEX_ENTER(&rx_connHashTable_lock);
     rxLastConn ? (conn = rxLastConn, flag = 0) :
@@ -2274,13 +2273,12 @@ rxi_FindConnection(socket, host, port, serviceId, cid,
            MUTEX_EXIT(&rx_connHashTable_lock);
            return (struct rx_connection *) 0;
        }
-       /* epoch's high order bits mean route for security reasons only on
-        * the cid, not the host and port fields.
-        */
-       if (conn->epoch & 0x80000000) break;
-       if (((type == RX_CLIENT_CONNECTION) 
-            || (pp->host == host)) && (pp->port == port))
-         break;
+       if (pp->host == host && pp->port == port)
+           break;
+       if (type == RX_CLIENT_CONNECTION && pp->port == port)
+           break;
+       if (type == RX_CLIENT_CONNECTION && (conn->epoch & 0x80000000))
+           break;
       }
       if ( !flag )
       {
@@ -2312,7 +2310,7 @@ rxi_FindConnection(socket, host, port, serviceId, cid,
        CV_INIT(&conn->conn_call_cv, "conn call cv", CV_DEFAULT, 0);
        conn->next = rx_connHashTable[hashindex];
        rx_connHashTable[hashindex] = conn;
-       peer = conn->peer = rxi_FindPeer(host, port, 0, 1);
+       conn->peer = rxi_FindPeer(host, port, 0, 1);
        conn->type = RX_SERVER_CONNECTION;
        conn->lastSendTime = clock_Sec();   /* don't GC immediately */
        conn->epoch = epoch;
@@ -2335,27 +2333,9 @@ rxi_FindConnection(socket, host, port, serviceId, cid,
        rx_stats.nServerConns++;
        MUTEX_EXIT(&rx_stats_mutex);
     }
-    else
-    {
-    /* Ensure that the peer structure is set up in such a way that
-    ** replies in this connection go back to that remote interface
-    ** from which the last packet was sent out. In case, this packet's
-    ** source IP address does not match the peer struct for this conn,
-    ** then drop the refCount on conn->peer and get a new peer structure.
-    ** We can check the host,port field in the peer structure without the
-    ** rx_peerHashTable_lock because the peer structure has its refCount
-    ** incremented and the only time the host,port in the peer struct gets
-    ** updated is when the peer structure is created.
-    */
-       if (conn->peer->host == host )
-               peer = conn->peer; /* no change to the peer structure */
-       else
-               peer = rxi_FindPeer(host, port, conn->peer, 1);
-    }
 
     MUTEX_ENTER(&conn->conn_data_lock);
     conn->refCount++;
-    conn->peer = peer;
     MUTEX_EXIT(&conn->conn_data_lock);
 
     rxLastConn = conn; /* store this connection as the last conn used */