#include <roken.h>
+#include <afs/opr.h>
+#ifdef AFS_PTHREAD_ENV
+# include <opr/lock.h>
+#else
+# include <opr/lockstub.h>
+#endif
+
#include <lock.h>
-#include <rx/xdr.h>
#include <rx/rx.h>
#include <rx/rxkad.h>
#include <rx/rx_multi.h>
}
static int
-amSyncSite(void) {
+amSyncSite(void)
+{
afs_int32 now;
afs_int32 rcode;
tt.tv_sec = temp;
tt.tv_usec = 0;
#ifdef AFS_PTHREAD_ENV
- code = select(0, 0, 0, 0, &tt);
+ select(0, 0, 0, 0, &tt);
#else
- code = IOMGR_Select(0, 0, 0, 0, &tt);
+ IOMGR_Select(0, 0, 0, 0, &tt);
#endif
- } else
- code = 0;
+ }
lastWakeupTime = FT_ApproxTime(); /* started a new collection phase */
UBIK_BEACON_LOCK;
ts->lastBeaconSent = temp;
code = multi_error;
+
+ if (code > 0 && ((code < temp && code < temp - 3600) ||
+ (code > temp && code > temp + 3600))) {
+ /* if we reached here, supposedly the remote host voted
+ * for us based on a computation from over an hour ago in
+ * the past, or over an hour in the future. this is
+ * unlikely; what actually probably happened is that the
+ * call generated some error and was aborted. this can
+ * happen due to errors with the rx security class in play
+ * (rxkad, rxgk, etc). treat the host as if we got a
+ * timeout, since this is not a valid vote. */
+ ubik_print("assuming distant vote time %d from %s is an error; marking host down\n",
+ (int)code, afs_inet_ntoa_r(ts->addr[0], hoststr));
+ code = -1;
+ }
+ if (code > 0 && rx_ConnError(connections[multi_i])) {
+ ubik_print("assuming vote from %s is invalid due to conn error %d; marking host down\n",
+ afs_inet_ntoa_r(ts->addr[0], hoststr),
+ (int)rx_ConnError(connections[multi_i]));
+ code = -1;
+ }
+
/* note that the vote time (the return code) represents the time
* the vote was computed, *not* the time the vote expires. We compute
* the latter down below if we got enough votes to go with */
}
if (count <= 0) { /* no address found */
- ubik_print("ubik: No network addresses found, aborting..");
+ ubik_print("ubik: No network addresses found, aborting..\n");
return UBADHOST;
}
*ame = myAddr[0];
tcount = rx_getAllAddr(myAddr2, UBIK_MAX_INTERFACE_ADDR);
if (tcount <= 0) { /* no address found */
- ubik_print("ubik: No network addresses found, aborting..");
+ ubik_print("ubik: No network addresses found, aborting..\n");
return UBADHOST;
}
UBIK_ADDR_UNLOCK;
} else if (multi_error == UBADHOST) {
code = UBADHOST; /* remote CellServDB inconsistency */
- ubik_print("Inconsistent Cell Info on server: ");
+ ubik_print("Inconsistent Cell Info on server:\n");
UBIK_ADDR_LOCK;
for (j = 0; j < UBIK_MAX_INTERFACE_ADDR && ts->addr[j]; j++)
- ubik_print("%s ", afs_inet_ntoa_r(ts->addr[j], hoststr));
+ ubik_print("... %s\n", afs_inet_ntoa_r(ts->addr[j], hoststr));
UBIK_ADDR_UNLOCK;
- ubik_print("\n");
} else {
UBIK_BEACON_LOCK;
ts->up = 0; /* mark the remote server as down */