static void checkFellowMasterWalk( void* o, c_voidp userData) { struct checkFellowMasterHelper* helper; d_networkAddress master; d_nameSpace nameSpace; helper = (struct checkFellowMasterHelper*)userData; nameSpace = d_nameSpace(o); master = d_nameSpaceGetMaster (nameSpace); if (d_nameSpaceIsMasterConfirmed (nameSpace)) { if (!d_networkAddressCompare (helper->fellow, master)) { d_adminReportMaster (helper->admin, nameSpace, helper->oldNameSpace); } } d_networkAddressFree (master); }
static void checkFellowMasterWalk( void* o, c_voidp userData) { struct checkFellowMasterHelper* helper; d_networkAddress master, fellow; d_nameSpace nameSpace; helper = (struct checkFellowMasterHelper*)userData; nameSpace = d_nameSpace(o); /* the namespace of the fellow */ master = d_nameSpaceGetMaster (nameSpace); /* the master of the namespace of the fellow */ fellow = d_fellowGetAddress(helper->fellow); /* Only start checking for conflicts if the fellow is a master * for the namespace and the namespace is confirmed */ if (!d_networkAddressCompare (fellow, master) && d_nameSpaceIsMasterConfirmed(nameSpace)) { d_adminReportMaster (helper->admin, helper->fellow, nameSpace, helper->oldNameSpace); } d_networkAddressFree(master); d_networkAddressFree(fellow); }
d_nameSpaces d_nameSpacesNew( d_admin admin, d_nameSpace nameSpace, d_quality initialQuality, c_ulong total) { d_nameSpaces ns = NULL; d_networkAddress master; d_mergeState state; c_sequence *mergedStatesPtr; struct nsWalkHelper helper; if(nameSpace){ ns = d_nameSpaces(os_malloc(C_SIZEOF(d_nameSpaces))); if(ns){ master = d_networkAddressUnaddressed(); d_messageInit(d_message(ns), admin); ns->aligner = d_nameSpaceIsAligner(nameSpace); ns->durabilityKind = d_nameSpaceGetDurabilityKind(nameSpace); ns->alignmentKind = d_nameSpaceGetAlignmentKind(nameSpace); ns->partitions = d_nameSpaceGetPartitionTopics(nameSpace); ns->total = total; ns->initialQuality.seconds = initialQuality.seconds; ns->initialQuality.nanoseconds = initialQuality.nanoseconds; ns->master.systemId = master->systemId; ns->master.localId = master->localId; ns->master.lifecycleId = master->lifecycleId; ns->isComplete = TRUE; ns->name = os_strdup (d_nameSpaceGetName(nameSpace)); ns->masterConfirmed = d_nameSpaceIsMasterConfirmed(nameSpace); state = d_nameSpaceGetMergeState(nameSpace, NULL); if(state) { ns->state.role = os_strdup(state->role); ns->state.value = state->value; d_mergeStateFree(state); } else { ns->state.role = d_nameSpaceGetRole(nameSpace); ns->state.value = -1; } ns->mergedStatesCount = d_tableSize(nameSpace->mergedRoleStates); if(ns->mergedStatesCount > 0){ ns->mergedStates = os_malloc(C_SIZEOF(d_mergeState)*ns->mergedStatesCount); helper.states = (d_mergeState*)(mergedStatesPtr = &(ns->mergedStates)); helper.index = 0; d_tableWalk(nameSpace->mergedRoleStates, addMergeState, &helper); } else { ns->mergedStates = NULL; } d_networkAddressFree(master); } } return ns; }