ubik: Convert DoProbe 'i' to 'nconns'
authorAndrew Deason <adeason@sinenomine.net>
Mon, 13 Oct 2014 20:06:36 +0000 (15:06 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Tue, 2 Dec 2014 22:51:12 +0000 (17:51 -0500)
DoProbe was using the variable 'i' to keep track of how many
connections we have in the conns array. Keep track of this separately
using a variable called 'nconns' instead, to make this function a bit
less confusing.

Change-Id: Ica2b4901c083b315e901366820042fad64030b3c
Reviewed-on: http://gerrit.openafs.org/11540
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/ubik/recovery.c

index 44c10fa..fcbaec6 100644 (file)
@@ -874,7 +874,7 @@ DoProbe(struct ubik_server *server)
 {
     struct rx_connection *conns[UBIK_MAX_INTERFACE_ADDR];
     struct rx_connection *connSuccess = 0;
-    int i, j, success_i = -1;
+    int i, nconns, success_i = -1;
     afs_uint32 addr;
     char buffer[32];
     char hoststr[16];
@@ -893,9 +893,10 @@ DoProbe(struct ubik_server *server)
        }
     }
     UBIK_ADDR_UNLOCK;
-    opr_Assert(i);                     /* at least one interface address for this server */
+    nconns = i;
+    opr_Assert(nconns);                        /* at least one interface address for this server */
 
-    multi_Rx(conns, i) {
+    multi_Rx(conns, nconns) {
        multi_DISK_Probe();
        if (!multi_error) {     /* first success */
            success_i = multi_i;
@@ -928,9 +929,9 @@ DoProbe(struct ubik_server *server)
     }
 
     /* Destroy all connections except the one on which we succeeded */
-    for (j = 0; j < i; j++)
-       if (conns[j] != connSuccess)
-           rx_DestroyConnection(conns[j]);
+    for (i = 0; i < nconns; i++)
+       if (conns[i] != connSuccess)
+           rx_DestroyConnection(conns[i]);
 
     if (!connSuccess)
        ubik_dprint("ubik:server %s still down\n",