diff options
author | Arthur Valadares | 2009-07-23 16:57:41 +0000 |
---|---|---|
committer | Arthur Valadares | 2009-07-23 16:57:41 +0000 |
commit | 7bf59c551e60736303921b69812378329be3539a (patch) | |
tree | 9f011ba074e783be0ed0b987669a6979983bb318 /OpenSim/Region/CoreModules/ServiceConnectorsOut | |
parent | Formatting cleanup. (diff) | |
download | opensim-SC_OLD-7bf59c551e60736303921b69812378329be3539a.zip opensim-SC_OLD-7bf59c551e60736303921b69812378329be3539a.tar.gz opensim-SC_OLD-7bf59c551e60736303921b69812378329be3539a.tar.bz2 opensim-SC_OLD-7bf59c551e60736303921b69812378329be3539a.tar.xz |
* Updates RESTInterregionComms and LocalInterregionComms to the new region module interface. This fixes an issue where region references were being added but weren't being deleted,
causing those "unnotified circuit" messages.
* Also fixes tests accordingly
- Fixes Mantis #3452
- Fixes Mantis #3388
- Fixes Mantis #3871
- Related to Mantis #3493
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs | 61 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs | 80 |
2 files changed, 92 insertions, 49 deletions
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 | ||
37 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | 37 | namespace 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 | ||
46 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | 46 | namespace 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 | { |