OpenSim.Region.Framework.Scenes.ScenePresence.RemoveNeighbourRegion C# (CSharp) Méthode

RemoveNeighbourRegion() public méthode

public RemoveNeighbourRegion ( ulong regionHandle ) : void
regionHandle ulong
Résultat void
        public void RemoveNeighbourRegion(ulong regionHandle)
        {
            lock (m_knownChildRegions)
            {
                if (m_knownChildRegions.ContainsKey(regionHandle))
                {
                    m_knownChildRegions.Remove(regionHandle);
                   //m_log.Debug(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count);
                }
            }
        }

Usage Example

        /// <summary>
        /// Async component for informing client of which neighbours exist
        /// </summary>
        /// <remarks>
        /// This needs to run asynchronously, as a network timeout may block the thread for a long while
        /// </remarks>
        /// <param name="remoteClient"></param>
        /// <param name="a"></param>
        /// <param name="regionHandle"></param>
        /// <param name="endPoint"></param>
        private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData agentCircData, GridRegion reg,
                                                  IPEndPoint endPoint, bool newAgent)
        {

            if (newAgent)
            {
                // we may already had lost this sp
                if(sp == null || sp.IsDeleted || sp.ClientView == null) // something bad already happened 
                   return;

                Scene scene = sp.Scene;

                m_log.DebugFormat(
                    "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
                    sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);

                string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(agentCircData.CapsPath);

                string reason = String.Empty;

                EntityTransferContext ctx = new EntityTransferContext();
                bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, agentCircData, (uint)TeleportFlags.Default, ctx, out reason);

                if (regionAccepted)
                {
                    // give  time for createAgent to finish, since it is async and does grid services access              
                    Thread.Sleep(500);

                    if (m_eqModule != null)
                    {
                        #region IP Translation for NAT
                        if(sp == null || sp.IsDeleted || sp.ClientView == null) // something bad already happened 
                            return;

                        IClientIPEndpoint ipepClient;
                        if (sp.ClientView.TryGet(out ipepClient))
                        {
                            endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
                        }
                        #endregion

                        m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
                            "and EstablishAgentCommunication with seed cap {8}", LogHeader,
                            scene.RegionInfo.RegionName, sp.Name,
                            reg.RegionName, reg.RegionLocX, reg.RegionLocY, reg.RegionSizeX, reg.RegionSizeY, capsPath);

                        m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID, reg.RegionSizeX, reg.RegionSizeY);
                        m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath, reg.RegionHandle, reg.RegionSizeX, reg.RegionSizeY);
                    }
                    else
                    {
                        sp.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, endPoint);
                        // TODO: make Event Queue disablable!
                    }

                    m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Completed inform {0} {1} about neighbour {2}", sp.Name, sp.UUID, endPoint);
                }

                else
                {
                    sp.RemoveNeighbourRegion(reg.RegionHandle);
                    m_log.WarnFormat(
                        "[ENTITY TRANSFER MODULE]: Region {0} did not accept {1} {2}: {3}",
                        reg.RegionName, sp.Name, sp.UUID, reason);
                }
            }
 
        }
ScenePresence