aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs61
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs80
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs2
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs1
6 files changed, 98 insertions, 54 deletions
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index f910550..c0932bd 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -30,6 +30,8 @@
30 <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> 30 <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" />
31 <RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" /> 31 <RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" />
32 <RegionModule id="RemoteLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.RemoteLandServicesConnector" /> 32 <RegionModule id="RemoteLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.RemoteLandServicesConnector" />
33 <RegionModule id="LocalInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.LocalInterregionComms" />
34 <RegionModule id="RESTInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.RESTInterregionComms" />
33 <!-- Service connectors IN modules --> 35 <!-- Service connectors IN modules -->
34 <RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" /> 36 <RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" />
35 <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> 37 <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" />
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
index 9af0f66..712a12b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
@@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Scenes;
36 36
37namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion 37namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
38{ 38{
39 public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn 39 public class LocalInterregionComms : ISharedRegionModule, IInterregionCommsOut, IInterregionCommsIn
40 { 40 {
41 private bool m_enabled = false; 41 private bool m_enabled = false;
42 42
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
50 50
51 #region IRegionModule 51 #region IRegionModule
52 52
53 public void Initialise(Scene scene, IConfigSource config) 53 public void Initialise(IConfigSource config)
54 { 54 {
55 if (m_sceneList.Count == 0) 55 if (m_sceneList.Count == 0)
56 { 56 {
@@ -62,30 +62,61 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
62 m_enabled = true; 62 m_enabled = true;
63 } 63 }
64 } 64 }
65 }
65 66
66 if (!m_enabled) 67 public void PostInitialise()
67 return; 68 {
69 }
68 70
69 Init(scene); 71 public void AddRegion(Scene scene)
72 {
70 } 73 }
71 74
72 public void PostInitialise() 75 public void RemoveRegion(Scene scene)
73 { 76 {
77 if (m_enabled)
78 {
79 RemoveScene(scene);
80 }
81 }
82
83 public void RegionLoaded(Scene scene)
84 {
85 if (m_enabled)
86 {
87 Init(scene);
88 }
74 } 89 }
75 90
76 public void Close() 91 public void Close()
77 { 92 {
78 } 93 }
79 94
95 public Type ReplacableInterface
96 {
97 get { return null; }
98 }
99
80 public string Name 100 public string Name
81 { 101 {
82 get { return "LocalInterregionCommsModule"; } 102 get { return "LocalInterregionCommsModule"; }
83 } 103 }
84 104
85 public bool IsSharedModule 105 /// <summary>
106 /// Can be called from other modules.
107 /// </summary>
108 /// <param name="scene"></param>
109 public void RemoveScene(Scene scene)
86 { 110 {
87 get { return true; } 111 lock (m_sceneList)
112 {
113 if (m_sceneList.Contains(scene))
114 {
115 m_sceneList.Remove(scene);
116 }
117 }
88 } 118 }
119
89 /// <summary> 120 /// <summary>
90 /// Can be called from other modules. 121 /// Can be called from other modules.
91 /// </summary> 122 /// </summary>
@@ -110,21 +141,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
110 #region IInterregionComms 141 #region IInterregionComms
111 142
112 /** 143 /**
113 * Agent-related communications 144 * Agent-related communications
114 */ 145 */
115 146
116 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason) 147 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
117 { 148 {
118 149
119 foreach (Scene s in m_sceneList) 150 foreach (Scene s in m_sceneList)
120 { 151 {
121 if (s.RegionInfo.RegionHandle == regionHandle) 152 if (s.RegionInfo.RegionHandle == regionHandle)
122 { 153 {
123// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); 154// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle);
124 return s.NewUserConnection(aCircuit, out reason); 155 return s.NewUserConnection(aCircuit, out reason);
125 } 156 }
126 } 157 }
127 158
128// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); 159// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle);
129 reason = "Did not find region."; 160 reason = "Did not find region.";
130 return false; 161 return false;
@@ -137,14 +168,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
137 if (s.RegionInfo.RegionHandle == regionHandle) 168 if (s.RegionInfo.RegionHandle == regionHandle)
138 { 169 {
139 //m_log.DebugFormat( 170 //m_log.DebugFormat(
140 // "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate", 171 // "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate",
141 // s.RegionInfo.RegionName, regionHandle); 172 // s.RegionInfo.RegionName, regionHandle);
142 173
143 s.IncomingChildAgentDataUpdate(cAgentData); 174 s.IncomingChildAgentDataUpdate(cAgentData);
144 return true; 175 return true;
145 } 176 }
146 } 177 }
147 178
148// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); 179// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
149 return false; 180 return false;
150 } 181 }
@@ -218,7 +249,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
218 } 249 }
219 250
220 /** 251 /**
221 * Object-related communications 252 * Object-related communications
222 */ 253 */
223 254
224 public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall) 255 public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 7f9167d..fd5ccee 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -45,7 +45,7 @@ using OpenSim.Region.Framework.Scenes.Serialization;
45 45
46namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion 46namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
47{ 47{
48 public class RESTInterregionComms : IRegionModule, IInterregionCommsOut 48 public class RESTInterregionComms : ISharedRegionModule, IInterregionCommsOut
49 { 49 {
50 private bool initialized = false; 50 private bool initialized = false;
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -64,51 +64,63 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
64 64
65 #region IRegionModule 65 #region IRegionModule
66 66
67 public virtual void Initialise(Scene scene, IConfigSource config) 67 public virtual void Initialise(IConfigSource config)
68 { 68 {
69 if (!initialized) 69 IConfig startupConfig = config.Configs["Communications"];
70 {
71 initialized = true;
72 IConfig startupConfig = config.Configs["Communications"];
73
74 if ((startupConfig == null)
75 || (startupConfig != null)
76 && (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms"))
77 {
78 m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module");
79 m_enabled = true;
80 if (config.Configs["Hypergrid"] != null)
81 m_safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
82 70
83 InitOnce(scene); 71 if ((startupConfig == null) || ((startupConfig != null)
84 } 72 && (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms")))
73 {
74 m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module");
75 m_enabled = true;
76 if (config.Configs["Hypergrid"] != null)
77 m_safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
85 } 78 }
79 }
86 80
87 if (!m_enabled) 81 public virtual void PostInitialise()
88 return; 82 {
83 }
89 84
90 InitEach(scene); 85 public virtual void Close()
86 {
87 }
91 88
89 public void AddRegion(Scene scene)
90 {
92 } 91 }
93 92
94 public virtual void PostInitialise() 93 public void RemoveRegion(Scene scene)
95 { 94 {
96 if (m_enabled) 95 if (m_enabled)
97 AddHTTPHandlers(); 96 {
97 m_localBackend.RemoveScene(scene);
98 scene.UnregisterModuleInterface<IInterregionCommsOut>(this);
99 }
98 } 100 }
99 101
100 public virtual void Close() 102 public void RegionLoaded(Scene scene)
101 { 103 {
104 if (m_enabled)
105 {
106 if (!initialized)
107 {
108 InitOnce(scene);
109 initialized = true;
110 AddHTTPHandlers();
111 }
112 InitEach(scene);
113 }
102 } 114 }
103 115
104 public virtual string Name 116 public Type ReplacableInterface
105 { 117 {
106 get { return "RESTInterregionCommsModule"; } 118 get { return null; }
107 } 119 }
108 120
109 public virtual bool IsSharedModule 121 public virtual string Name
110 { 122 {
111 get { return true; } 123 get { return "RESTInterregionCommsModule"; }
112 } 124 }
113 125
114 protected virtual void InitEach(Scene scene) 126 protected virtual void InitEach(Scene scene)
@@ -137,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
137 #region IInterregionComms 149 #region IInterregionComms
138 150
139 /** 151 /**
140 * Agent-related communications 152 * Agent-related communications
141 */ 153 */
142 154
143 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason) 155 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
@@ -257,7 +269,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
257 } 269 }
258 270
259 /** 271 /**
260 * Object-related communications 272 * Object-related communications
261 */ 273 */
262 274
263 public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall) 275 public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall)
@@ -527,7 +539,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
527 protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle) 539 protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle)
528 { 540 {
529 //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle); 541 //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle);
530 542
531 if (action.Equals("release")) 543 if (action.Equals("release"))
532 m_localBackend.SendReleaseAgent(regionHandle, id, ""); 544 m_localBackend.SendReleaseAgent(regionHandle, id, "");
533 else 545 else
@@ -613,7 +625,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
613 extraStr = args["extra"].AsString(); 625 extraStr = args["extra"].AsString();
614 626
615 UUID regionID = m_localBackend.GetRegionID(regionhandle); 627 UUID regionID = m_localBackend.GetRegionID(regionhandle);
616 SceneObjectGroup sog = null; 628 SceneObjectGroup sog = null;
617 try 629 try
618 { 630 {
619 sog = SceneObjectSerializer.FromXml2Format(sogXmlStr); 631 sog = SceneObjectSerializer.FromXml2Format(sogXmlStr);
@@ -675,7 +687,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
675 responsedata["str_response_string"] = result.ToString(); 687 responsedata["str_response_string"] = result.ToString();
676 } 688 }
677 689
678 #endregion 690 #endregion
679 691
680 #region Misc 692 #region Misc
681 693
@@ -707,7 +719,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
707 UInt64.TryParse(parts[2], out regionHandle); 719 UInt64.TryParse(parts[2], out regionHandle);
708 if (parts.Length >= 4) 720 if (parts.Length >= 4)
709 action = parts[3]; 721 action = parts[3];
710 722
711 return true; 723 return true;
712 } 724 }
713 } 725 }
@@ -759,7 +771,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
759 } 771 }
760 772
761 773
762 #endregion Misc 774 #endregion Misc
763 775
764 protected class RegionToRegionClient : RegionClient 776 protected class RegionToRegionClient : RegionClient
765 { 777 {
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index f0c31d0..1836447 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -71,10 +71,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
71 scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000, cm); 71 scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000, cm);
72 scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000, cm); 72 scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000, cm);
73 73
74 IRegionModule interregionComms = new RESTInterregionComms(); 74 ISharedRegionModule interregionComms = new RESTInterregionComms();
75 interregionComms.Initialise(scene, new IniConfigSource()); 75 interregionComms.Initialise(new IniConfigSource());
76 interregionComms.Initialise(scene2, new IniConfigSource());
77 interregionComms.Initialise(scene3, new IniConfigSource());
78 interregionComms.PostInitialise(); 76 interregionComms.PostInitialise();
79 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); 77 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
80 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); 78 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
index 1be2285..ed2d317 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
65 TestCommunicationsManager cm = new TestCommunicationsManager(); 65 TestCommunicationsManager cm = new TestCommunicationsManager();
66 66
67 // shared module 67 // shared module
68 IRegionModule interregionComms = new RESTInterregionComms(); 68 ISharedRegionModule interregionComms = new RESTInterregionComms();
69 69
70 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); 70 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm);
71 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); 71 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 7f5d8e6..a152ea6 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -214,6 +214,7 @@ namespace OpenSim.Tests.Common.Setup
214 foreach (IRegionModuleBase module in newModules) 214 foreach (IRegionModuleBase module in newModules)
215 { 215 {
216 module.AddRegion(scene); 216 module.AddRegion(scene);
217 module.RegionLoaded(scene);
217 scene.AddRegionModule(module.Name, module); 218 scene.AddRegionModule(module.Name, module);
218 } 219 }
219 220