Exemplo n.º 1
0
        // TODO: unused: private bool m_AllowForeignGuests;

        public NeighbourPostHandler(INeighbourService service, IAuthenticationService authentication) :
            base("POST", "/region")
        {
            m_NeighbourService = service;
            m_AuthenticationService = authentication;
            // TODO: unused: m_AllowForeignGuests = foreignGuests;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Asynchronous call to information neighbouring regions that this region is up
        /// </summary>
        /// <param name="region"></param>
        /// <param name="regionhandle"></param>
        private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
        {
            uint x = 0, y = 0;
            Utils.LongToUInts(regionhandle, out x, out y);

            GridRegion neighbour = null;
            if (neighbourService != null)
                neighbour = neighbourService.HelloNeighbour(regionhandle, region);
            else
                m_log.DebugFormat( "{0} neighbour service provided for region {0} to inform neigbhours of status", LogHeader, m_scene.Name);

            if (neighbour != null)
            {
                m_log.DebugFormat( "{0} Region {1} successfully informed neighbour {2} at {3}-{4} that it is up",
                    LogHeader, m_scene.Name, neighbour.RegionName, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y));

                m_scene.EventManager.TriggerOnRegionUp(neighbour);
            }
            else
            {
                m_log.WarnFormat(
                    "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.",
                    m_scene.Name, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y));
            }
        }
        // TODO: unused: private bool m_AllowForeignGuests;

        public NeighbourPostHandler(INeighbourService service, IAuthenticationService authentication) :
            base("POST", "/region")
        {
            m_NeighbourService      = service;
            m_AuthenticationService = authentication;
            // TODO: unused: m_AllowForeignGuests = foreignGuests;
        }
Exemplo n.º 4
0
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);

            List <GridRegion> neighbours
                = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);

            m_log.DebugFormat(
                "[SCENE COMMUNICATION SERVICE]: Informing {0} neighbours that region {1} is up",
                neighbours.Count, m_scene.Name);

            foreach (GridRegion n in neighbours)
            {
                OpenSim.Framework.RegionFlags?regionFlags = n.RegionFlags;

                // Robust services before 2015-01-14 do not return the regionFlags information.  In this case, we could
                // make a separate RegionFlags call but this would involve a network call for each neighbour.
                if (regionFlags != null)
                {
                    if ((regionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0)
                    {
                        continue;
                    }
                }

                InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
                d.BeginInvoke(neighbourService, region, n.RegionHandle,
                              InformNeighborsThatRegionisUpCompleted,
                              d);
            }
        }
        /// <summary>
        /// Asynchronous call to information neighbouring regions that this region is up
        /// </summary>
        /// <param name="region"></param>
        /// <param name="regionhandle"></param>
        private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
        {
            uint x = 0, y = 0;
            Utils.LongToUInts(regionhandle, out x, out y);

            GridRegion neighbour = null;
            if (neighbourService != null)
                neighbour = neighbourService.HelloNeighbour(regionhandle, region);
            else
                m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region");

            if (neighbour != null)
            {
                m_log.DebugFormat("[INTERGRID]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize);
                m_scene.EventManager.TriggerOnRegionUp(neighbour);
            }
            else
            {
                if (m_scene.GridService != null)
                {
                    neighbour = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
                    
                    if (neighbour != null)
                        m_log.InfoFormat("[INTERGRID]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize);
                }
            }
        }
        /// <summary>
        /// Asynchronous call to information neighbouring regions that this region is up
        /// </summary>
        /// <param name="region"></param>
        /// <param name="regionhandle"></param>
        private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
        {
            uint x = 0, y = 0;

            Utils.LongToUInts(regionhandle, out x, out y);

            GridRegion neighbour = null;

            if (neighbourService != null)
            {
                neighbour = neighbourService.HelloNeighbour(regionhandle, region);
            }
            else
            {
                m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region");
            }

            if (neighbour != null)
            {
                m_log.DebugFormat("[INTERGRID]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize);
                m_scene.EventManager.TriggerOnRegionUp(neighbour);
            }
            else
            {
                m_log.InfoFormat("[INTERGRID]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Asynchronous call to information neighbouring regions that this region is up
        /// </summary>
        /// <param name="region"></param>
        /// <param name="regionhandle"></param>
        private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
        {
            uint x = 0, y = 0;

            Utils.LongToUInts(regionhandle, out x, out y);

            GridRegion neighbour = null;

            if (neighbourService != null)
            {
                neighbour = neighbourService.HelloNeighbour(regionhandle, region);
            }
            else
            {
                m_log.DebugFormat(
                    "[SCENE COMMUNICATION SERVICE]: No neighbour service provided for region {0} to inform neigbhours of status",
                    m_scene.Name);
            }

            if (neighbour != null)
            {
                m_log.DebugFormat(
                    "[SCENE COMMUNICATION SERVICE]: Region {0} successfully informed neighbour {1} at {2}-{3} that it is up",
                    m_scene.Name, neighbour.RegionName, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y));

                m_scene.EventManager.TriggerOnRegionUp(neighbour);
            }
            else
            {
                m_log.WarnFormat(
                    "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.",
                    m_scene.Name, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y));
            }
        }
Exemplo n.º 8
0
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
            if (neighbourService == null)
            {
                m_log.ErrorFormat("{0} No neighbour service provided for region {1} to inform neigbhours of status", LogHeader, m_scene.Name);
                return;
            }

            List <GridRegion> neighbours
                = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);

            List <ulong> onlineNeighbours = new List <ulong>();

            foreach (GridRegion n in neighbours)
            {
                //m_log.DebugFormat(
                //   "{0}: Region flags for {1} as seen by {2} are {3}",
                //    LogHeader, n.RegionName, m_scene.Name, regionFlags != null ? regionFlags.ToString() : "not present");

                // Robust services before 2015-01-14 do not return the regionFlags information.  In this case, we could
                // make a separate RegionFlags call but this would involve a network call for each neighbour.
                if (n.RegionFlags != null)
                {
                    if ((n.RegionFlags & OpenSim.Framework.RegionFlags.RegionOnline) != 0)
                    {
                        onlineNeighbours.Add(n.RegionHandle);
                    }
                }
                else
                {
                    onlineNeighbours.Add(n.RegionHandle);
                }
            }

            if (onlineNeighbours.Count > 0)
            {
                Util.FireAndForget(o =>
                {
                    foreach (ulong regionhandle in onlineNeighbours)
                    {
                        Util.RegionHandleToRegionLoc(regionhandle, out uint rx, out uint ry);
                        GridRegion neighbour = neighbourService.HelloNeighbour(regionhandle, region);
                        if (neighbour != null)
                        {
                            m_log.DebugFormat("{0} Region {1} successfully informed neighbour {2} at {3}-{4} that it is up",
                                              LogHeader, m_scene.Name, neighbour.RegionName, rx, ry);

                            m_scene.EventManager.TriggerOnRegionUp(neighbour);
                        }
                        else
                        {
                            m_log.WarnFormat("{0} Region {1} failed to inform neighbour at {2}-{3} that it is up.",
                                             LogHeader, m_scene.Name, rx, ry);
                        }
                    }
                });
            }
        }
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);

            List <GridRegion> neighbours = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);

            m_log.DebugFormat("[INTERGRID]: Informing {0} neighbours that this region is up", neighbours.Count);
            foreach (GridRegion n in neighbours)
            {
                InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
                d.BeginInvoke(neighbourService, region, n.RegionHandle,
                              InformNeighborsThatRegionisUpCompleted,
                              d);
            }
        }
Exemplo n.º 10
0
        public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) :
            base(source, server, String.Empty)
        {
            m_NeighbourService = nService;
            if (m_NeighbourService == null)
            {
                m_log.Error("[NEIGHBOUR IN CONNECTOR]: neighbour service was not provided");
                return;
            }

            //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false);
            //if (authentication)
            //    m_AuthenticationService = scene.RequestModuleInterface<IAuthenticationService>();

            server.AddSimpleStreamHandler(new NeighbourSimpleHandler(m_NeighbourService, m_AuthenticationService));
        }
Exemplo n.º 11
0
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);

            List <GridRegion> neighbours
                = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);

            List <GridRegion> onlineNeighbours = new List <GridRegion>();

            foreach (GridRegion n in neighbours)
            {
                OpenSim.Framework.RegionFlags?regionFlags = n.RegionFlags;

//                m_log.DebugFormat(
//                    "{0}: Region flags for {1} as seen by {2} are {3}",
//                    LogHeader, n.RegionName, m_scene.Name, regionFlags != null ? regionFlags.ToString() : "not present");

                // Robust services before 2015-01-14 do not return the regionFlags information.  In this case, we could
                // make a separate RegionFlags call but this would involve a network call for each neighbour.
                if (regionFlags != null)
                {
                    if ((regionFlags & OpenSim.Framework.RegionFlags.RegionOnline) != 0)
                    {
                        onlineNeighbours.Add(n);
                    }
                }
                else
                {
                    onlineNeighbours.Add(n);
                }
            }

            m_log.DebugFormat(
                "{0} Informing {1} neighbours that region {2} is up",
                LogHeader, onlineNeighbours.Count, m_scene.Name);

            foreach (GridRegion n in onlineNeighbours)
            {
                InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
                d.BeginInvoke(neighbourService, region, n.RegionHandle,
                              InformNeighborsThatRegionisUpCompleted,
                              d);
            }
        }
        public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) :
                base(source, server, String.Empty)
        {

            m_NeighbourService = nService;
            if (m_NeighbourService == null)
            {
                m_log.Error("[NEIGHBOUR IN CONNECTOR]: neighbour service was not provided");
                return;
            }
            
            //bool authentication = neighbourConfig.GetBoolean("RequireAuthentication", false);
            //if (authentication)
            //    m_AuthenticationService = scene.RequestModuleInterface<IAuthenticationService>();


            server.AddStreamHandler(new NeighbourPostHandler(m_NeighbourService, m_AuthenticationService));
            server.AddStreamHandler(new NeighbourGetHandler(m_NeighbourService, m_AuthenticationService));
        }
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);

            for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++)
            {
                for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
                {
                    if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
                    {
                        ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
                        InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;

                        d.BeginInvoke(neighbourService, region, handle,
                                      InformNeighborsThatRegionisUpCompleted,
                                      d);
                    }
                }
            }
        }
        // TODO: unused: private ISimulationService m_SimulationService;
        // TODO: unused: private IAuthenticationService m_AuthenticationService;

        public NeighbourGetHandler(INeighbourService service, IAuthenticationService authentication) :
            base("GET", "/region")
        {
            // TODO: unused: m_SimulationService = service;
            // TODO: unused: m_AuthenticationService = authentication;
        }
Exemplo n.º 15
0
        // TODO: unused: private ISimulationService m_SimulationService;
        // TODO: unused: private IAuthenticationService m_AuthenticationService;

        public NeighbourGetHandler(INeighbourService service, IAuthenticationService authentication) :
                base("GET", "/region")
        {
            // TODO: unused: m_SimulationService = service;
            // TODO: unused: m_AuthenticationService = authentication;
        }
Exemplo n.º 16
0
 public NeighbourSimpleHandler(INeighbourService service, IAuthenticationService authentication) :
     base("/region")
 {
     m_NeighbourService      = service;
     m_AuthenticationService = authentication;
 }
Exemplo n.º 17
0
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);

            List<GridRegion> neighbours
                = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);

            List<GridRegion> onlineNeighbours = new List<GridRegion>();

            foreach (GridRegion n in neighbours)
            {
                OpenSim.Framework.RegionFlags? regionFlags = n.RegionFlags;

//                m_log.DebugFormat(
//                    "{0}: Region flags for {1} as seen by {2} are {3}", 
//                    LogHeader, n.RegionName, m_scene.Name, regionFlags != null ? regionFlags.ToString() : "not present");

                // Robust services before 2015-01-14 do not return the regionFlags information.  In this case, we could
                // make a separate RegionFlags call but this would involve a network call for each neighbour.
                if (regionFlags != null)
                {
                    if ((regionFlags & OpenSim.Framework.RegionFlags.RegionOnline) != 0)
                        onlineNeighbours.Add(n);
                }
                else
                {
                    onlineNeighbours.Add(n);
                }
            }

            m_log.DebugFormat(
                "{0} Informing {1} neighbours that region {2} is up", 
                LogHeader, onlineNeighbours.Count, m_scene.Name);

            foreach (GridRegion n in onlineNeighbours)
            {
                InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
                d.BeginInvoke(neighbourService, region, n.RegionHandle,
                              InformNeighborsThatRegionisUpCompleted,
                              d);
            }
        }
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);

            List<GridRegion> neighbours = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);
            m_log.DebugFormat("[INTERGRID]: Informing {0} neighbours that this region is up", neighbours.Count);
            foreach (GridRegion n in neighbours)
            {
                InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
                d.BeginInvoke(neighbourService, region, n.RegionHandle,
                              InformNeighborsThatRegionisUpCompleted,
                              d);
            }
        }
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);

            List<GridRegion> neighbours
                = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);

            m_log.DebugFormat(
                "[SCENE COMMUNICATION SERVICE]: Informing {0} neighbours that region {1} is up",
                neighbours.Count, m_scene.Name);

            foreach (GridRegion n in neighbours)
            {
                OpenSim.Framework.RegionFlags? regionFlags = n.RegionFlags;

                // Robust services before 2015-01-14 do not return the regionFlags information.  In this case, we could
                // make a separate RegionFlags call but this would involve a network call for each neighbour.
                if (regionFlags != null)
                {
                    if ((regionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0)
                    {
                        continue;
                    }
                }

                InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
                d.BeginInvoke(neighbourService, region, n.RegionHandle,
                              InformNeighborsThatRegionisUpCompleted,
                              d);
            }
        }
        /// <summary>
        /// Asynchronous call to information neighbouring regions that this region is up
        /// </summary>
        /// <param name="region"></param>
        /// <param name="regionhandle"></param>
        private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
        {
            m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here");
            //RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port);

            //bool regionAccepted =
            //    m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region), regionhandle);

            //bool regionAccepted = m_interregionCommsOut.SendHelloNeighbour(regionhandle, region);
            bool regionAccepted = false;
            if (neighbourService != null)
                regionAccepted = neighbourService.HelloNeighbour(regionhandle, region);
            else
                m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region");

            if (regionAccepted)
            {
                m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here");
                handlerRegionUp = OnRegionUp;

                // yes, we're notifying ourselves.
                if (handlerRegionUp != null)
                    handlerRegionUp(region);
            }
            else
            {
                m_log.Warn("[INTERGRID]: Failed to inform neighbors that I'm here.");
            }
        }
Exemplo n.º 21
0
        // unused: private ISimulationService m_SimulationService;
        // unused: private IAuthenticationService m_AuthenticationService;

        public NeighbourDeleteHandler(INeighbourService service, IAuthenticationService authentication) :
            base("DELETE", "/region")
        {
            // unused: m_SimulationService = service;
            // unused: m_AuthenticationService = authentication;
        }
        /// <summary>
        /// Called by scene when region is initialized (not always when it's listening for agents)
        /// This is an inter-region message that informs the surrounding neighbors that the sim is up.
        /// </summary>
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);

            
            List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
            // This stays uncached because we don't already know about our neighbors at this point.
            neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
            if (neighbours != null)
            {
                for (int i = 0; i < neighbours.Count; i++)
                {
                    InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;

                    d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle,
                                  InformNeighborsThatRegionisUpCompleted,
                                  d);
                }
            }

            //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
        }
        public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
        {
            //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);

            for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++)
                for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
                    if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
                    {
                        ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
                        InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;

                        d.BeginInvoke(neighbourService, region, handle,
                                      InformNeighborsThatRegionisUpCompleted,
                                      d);
                    }

            //List<GridRegion> neighbours = new List<GridRegion>();
            //// This stays uncached because we don't already know about our neighbors at this point.

            //neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID);
            //if (neighbours != null)
            //{
            //    for (int i = 0; i < neighbours.Count; i++)
            //    {
            //        InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;

            //        d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle,
            //                      InformNeighborsThatRegionisUpCompleted,
            //                      d);
            //    }
            //}

            //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
        }