private void FindNewMaster(ulong handle) { IEnumerable <Simulator> _AllSimulators = AllSimulators; SimRegion R = SimRegion.GetRegion(handle); lock (_AllSimulators) { foreach (var simulator in _AllSimulators) { if (simulator.Client == client.gridClient) { continue; } if (simulator.Handle != handle) { continue; } GridClient cl = simulator.Client; R.SetMaster(cl); BotClient bc = BotClientFor(cl); if (SimRegion.IsMaster(simulator, bc.gridClient)) { bc.WorldSystem.MasteringRegions.Add(handle); } else { bc.WorldSystem.MasteringRegions.Add(handle); } Debug("Found a strong new client for region " + R + " as " + cl); return; } foreach (var simulator in _AllSimulators) { // if (simulator.Client == client.gridClient) continue; if (simulator.Handle != handle) { continue; } GridClient cl = simulator.Client; BotClient bc = BotClientFor(cl); if (SimRegion.IsMaster(simulator, bc.gridClient)) { bc.WorldSystem.MasteringRegions.Add(handle); } if (!cl.Network.Simulators.Contains(simulator)) { continue; } R.SetMaster(cl); Debug("Found a new client for region " + R + " as " + cl); return; } } Debug("UHT OH, No client is Mastering for region " + R); }
public void Network_OnSimConnectedHook(object sender, SimConnectedEventArgs e) { Simulator simulator = e.Simulator; ///base.Network_OnSimConnected(simulator); lock (WorldObjectsMasterLock) { if (simulator.Handle == 0) { Debug("Simulator Handle==0 for " + simulator); return; } EnsureSimulator(simulator); IsConnected = true; if (SimRegion.IsMaster(simulator, client.gridClient)) { Debug("---SIMMASTER---------" + client + " region: " + simulator); SetWorldMaster(true); SimMaster[simulator.Handle] = this; //client.Grid.RequestMapRegion(simulator.Name, GridLayerType.Objects); if (simulator.Name.Length > 0) { client.Grid.RequestMapRegion(simulator.Name, GridLayerType.Terrain); } else { Debug("no sim bname " + simulator); } client.Estate.RequestInfo(); //client.Grid.RequestMapRegion(simulator.Name, GridLayerType.LandForSale); //client.Grid.RequestMapItems(simulator.Handle,OpenMetaverse.GridItemType.Classified,GridLayerType.Terrain); MasteringRegions.Add(simulator.Handle); var MaintainSimCollisionsList = WorldPathSystem.MaintainSimCollisionsList; if (simulator == client.Network.CurrentSim) { lock (MaintainSimCollisionsList) { if (!MaintainSimCollisionsList.Contains(simulator.Handle)) { MaintainSimCollisionsList.Add(simulator.Handle); } } } //RequestGridInfos(simulator.Handle); } else { Debug("-----NOT SIMMASTER-------" + client + " region: " + simulator); MasteringRegions.Remove(simulator.Handle); if (MasteringRegions.Count == 0) { SetWorldMaster(false); Debug("------UNREGISTERING------" + client); } } } if (simulator == client.Network.CurrentSim) { StartupPostLoginQueues(); // new Thread(() => client.Appearance.SetPreviousAppearance(true)).Start(); } //if (simulator == client.Network.CurrentSim) { new Thread(() => { Thread.Sleep(30000); client.Appearance.SetPreviousAppearance(true); }).Start(); } }