/*! * \brief send a Probe to all the network address of this server * * \return 0 if success, else return 1 */ int DoProbe(struct ubik_server *server) { struct rx_connection *conns[UBIK_MAX_INTERFACE_ADDR]; struct rx_connection *connSuccess = 0; int i, j, success_i = -1; afs_uint32 addr; char buffer[32]; char hoststr[16]; UBIK_ADDR_LOCK; for (i = 0; (addr = server->addr[i]) && (i < UBIK_MAX_INTERFACE_ADDR); i++) { conns[i] = rx_NewConnection(addr, ubik_callPortal, DISK_SERVICE_ID, addr_globals.ubikSecClass, addr_globals.ubikSecIndex); /* user requirement to use only the primary interface */ if (ubikPrimaryAddrOnly) { i = 1; break; } } UBIK_ADDR_UNLOCK; opr_Assert(i); /* at least one interface address for this server */ multi_Rx(conns, i) { multi_DISK_Probe(); if (!multi_error) { /* first success */ success_i = multi_i; multi_Abort; } } multi_End_Ignore;
/*! * \brief send a Probe to all the network address of this server * * \return 0 if success, else return 1 */ int DoProbe(struct ubik_server *server) { struct rx_connection *conns[UBIK_MAX_INTERFACE_ADDR]; struct rx_connection *connSuccess = 0; int i, j; afs_uint32 addr; char buffer[32]; char hoststr[16]; extern afs_int32 ubikSecIndex; extern struct rx_securityClass *ubikSecClass; for (i = 0; (addr = server->addr[i]) && (i < UBIK_MAX_INTERFACE_ADDR); i++) { conns[i] = rx_NewConnection(addr, ubik_callPortal, DISK_SERVICE_ID, ubikSecClass, ubikSecIndex); /* user requirement to use only the primary interface */ if (ubikPrimaryAddrOnly) { i = 1; break; } } assert(i); /* at least one interface address for this server */ multi_Rx(conns, i) { multi_DISK_Probe(); if (!multi_error) { /* first success */ addr = server->addr[multi_i]; /* successful interface addr */ if (server->disk_rxcid) /* destroy existing conn */ rx_DestroyConnection(server->disk_rxcid); if (server->vote_rxcid) rx_DestroyConnection(server->vote_rxcid); /* make new connections */ server->disk_rxcid = conns[multi_i]; server->vote_rxcid = rx_NewConnection(addr, ubik_callPortal, VOTE_SERVICE_ID, ubikSecClass, ubikSecIndex); /* for vote reqs */ connSuccess = conns[multi_i]; strcpy(buffer, afs_inet_ntoa_r(server->addr[0], hoststr)); ubik_print ("ubik:server %s is back up: will be contacted through %s\n", buffer, afs_inet_ntoa_r(addr, hoststr)); multi_Abort; } } multi_End_Ignore;