29 using System.Collections.Generic;
31 using System.Reflection;
32 using System.Threading;
34 using OpenMetaverse.StructuredData;
36 using OpenSim.Framework;
37 using OpenSim.Framework.Client;
38 using OpenSim.Framework.Capabilities;
39 using OpenSim.Region.Framework.Interfaces;
40 using OpenSim.Services.Interfaces;
44 namespace OpenSim.
Region.Framework.Scenes
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 private static string LogHeader =
"[SCENE COMMUNICATION SERVICE]";
67 private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar)
69 InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate)iar.AsyncState;
81 Utils.LongToUInts(regionhandle, out x, out y);
84 if (neighbourService != null)
85 neighbour = neighbourService.HelloNeighbour(regionhandle, region);
87 m_log.DebugFormat(
"{0} neighbour service provided for region {0} to inform neigbhours of status", LogHeader, m_scene.Name);
89 if (neighbour != null)
91 m_log.DebugFormat(
"{0} Region {1} successfully informed neighbour {2} at {3}-{4} that it is up",
92 LogHeader, m_scene.Name, neighbour.RegionName, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y));
94 m_scene.EventManager.TriggerOnRegionUp(neighbour);
99 "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.",
100 m_scene.Name, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y));
108 List<GridRegion> neighbours
109 = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);
111 List<GridRegion> onlineNeighbours =
new List<GridRegion>();
123 if (regionFlags != null)
125 if ((regionFlags &
OpenSim.Framework.RegionFlags.RegionOnline) != 0)
126 onlineNeighbours.Add(n);
130 onlineNeighbours.Add(n);
135 "{0} Informing {1} neighbours that region {2} is up",
136 LogHeader, onlineNeighbours.Count, m_scene.Name);
140 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
141 d.BeginInvoke(neighbourService, region, n.RegionHandle,
142 InformNeighborsThatRegionisUpCompleted,
147 public delegate
void SendChildAgentDataUpdateDelegate(
AgentPosition cAgentData, UUID scopeID,
GridRegion dest);
161 m_scene.SimulationService.UpdateAgent(dest, cAgentData);
169 private void SendChildAgentDataUpdateCompleted(IAsyncResult iar)
171 SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate)iar.AsyncState;
185 List<string> simulatorList =
new List<string>();
188 if (regionHandle != m_regionInfo.RegionHandle)
193 Util.RegionHandleToWorldLoc(regionHandle, out x, out y);
194 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (
int)y);
198 if (!simulatorList.Contains(dest.ServerURI))
202 simulatorList.Add(dest.ServerURI);
204 m_scene.SimulationService.UpdateAgent(dest, cAgentData);
215 catch (InvalidOperationException)
221 public delegate
void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle);
233 Util.RegionHandleToWorldLoc(regionHandle, out x, out y);
235 GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (
int)y);
237 if (destination == null)
240 "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} FAIL, region with handle {1} not found", agentID, regionHandle);
245 "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName);
247 m_scene.SimulationService.CloseAgent(destination, agentID, auth_token);
258 if (regionslst.Count == 0)
262 Util.FireAndForget(o =>
264 foreach (ulong handle
in regionslst)
266 SendCloseChildAgent(agentID, handle, auth_code);
268 }, null,
"SceneCommunicationService.SendCloseChildAgentConnections");
273 return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber);
delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List< ulong > regionlst)
OpenSim.Framework.RegionInfo RegionInfo
Class that Region communications runs through
RegionFlags
Region flags used internally by OpenSimulator to store installation specific information about region...
void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence)
void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
OpenMetaverse.StructuredData.OSD OSD
Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms.
void SendCloseChildAgentConnections(UUID agentID, string auth_code, List< ulong > regionslst)
Closes a child agents in a collection of regions. Does so asynchronously so that the caller doesn't w...
Interactive OpenSim region server
List< GridRegion > RequestNamedRegions(string name, int maxNumber)
List< ulong > KnownRegionHandles
OpenMetaverse.StructuredData.OSD OSD
OpenSim.Services.Interfaces.GridRegion GridRegion
void SendCloseChildAgent(UUID agentID, ulong regionHandle, string auth_token)
This Closes child agents on neighboring regions Calls an asynchronous method to do so...