diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs | 474 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs | 34 |
2 files changed, 254 insertions, 254 deletions
diff --git a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs index ac40a17..48f737e 100644 --- a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs | |||
@@ -1,237 +1,237 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System.Collections.Generic; | 27 | using System.Collections.Generic; |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using log4net; | 29 | using log4net; |
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | 35 | ||
36 | namespace OpenSim.Region.CoreModules.Communications.Local | 36 | namespace OpenSim.Region.CoreModules.Communications.Local |
37 | { | 37 | { |
38 | public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn | 38 | public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn |
39 | { | 39 | { |
40 | private bool m_enabled = false; | 40 | private bool m_enabled = false; |
41 | 41 | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | private List<Scene> m_sceneList = new List<Scene>(); | 43 | private List<Scene> m_sceneList = new List<Scene>(); |
44 | 44 | ||
45 | #region Events | 45 | #region Events |
46 | public event ChildAgentUpdateReceived OnChildAgentUpdate; | 46 | public event ChildAgentUpdateReceived OnChildAgentUpdate; |
47 | 47 | ||
48 | #endregion /* Events */ | 48 | #endregion /* Events */ |
49 | 49 | ||
50 | #region IRegionModule | 50 | #region IRegionModule |
51 | 51 | ||
52 | public void Initialise(Scene scene, IConfigSource config) | 52 | public void Initialise(Scene scene, IConfigSource config) |
53 | { | 53 | { |
54 | if (m_sceneList.Count == 0) | 54 | if (m_sceneList.Count == 0) |
55 | { | 55 | { |
56 | IConfig startupConfig = config.Configs["Communications"]; | 56 | IConfig startupConfig = config.Configs["Communications"]; |
57 | 57 | ||
58 | if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms")) | 58 | if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms")) |
59 | { | 59 | { |
60 | m_log.Debug("[LOCAL COMMS]: Enabling InterregionComms LocalComms module"); | 60 | m_log.Debug("[LOCAL COMMS]: Enabling InterregionComms LocalComms module"); |
61 | m_enabled = true; | 61 | m_enabled = true; |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | if (!m_enabled) | 65 | if (!m_enabled) |
66 | return; | 66 | return; |
67 | 67 | ||
68 | Init(scene); | 68 | Init(scene); |
69 | } | 69 | } |
70 | 70 | ||
71 | public void PostInitialise() | 71 | public void PostInitialise() |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | public void Close() | 75 | public void Close() |
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | public string Name | 79 | public string Name |
80 | { | 80 | { |
81 | get { return "LocalInterregionCommsModule"; } | 81 | get { return "LocalInterregionCommsModule"; } |
82 | } | 82 | } |
83 | 83 | ||
84 | public bool IsSharedModule | 84 | public bool IsSharedModule |
85 | { | 85 | { |
86 | get { return true; } | 86 | get { return true; } |
87 | } | 87 | } |
88 | /// <summary> | 88 | /// <summary> |
89 | /// Can be called from other modules. | 89 | /// Can be called from other modules. |
90 | /// </summary> | 90 | /// </summary> |
91 | /// <param name="scene"></param> | 91 | /// <param name="scene"></param> |
92 | public void Init(Scene scene) | 92 | public void Init(Scene scene) |
93 | { | 93 | { |
94 | if (!m_sceneList.Contains(scene)) | 94 | if (!m_sceneList.Contains(scene)) |
95 | { | 95 | { |
96 | lock (m_sceneList) | 96 | lock (m_sceneList) |
97 | { | 97 | { |
98 | m_sceneList.Add(scene); | 98 | m_sceneList.Add(scene); |
99 | if (m_enabled) | 99 | if (m_enabled) |
100 | scene.RegisterModuleInterface<IInterregionCommsOut>(this); | 100 | scene.RegisterModuleInterface<IInterregionCommsOut>(this); |
101 | scene.RegisterModuleInterface<IInterregionCommsIn>(this); | 101 | scene.RegisterModuleInterface<IInterregionCommsIn>(this); |
102 | } | 102 | } |
103 | 103 | ||
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | #endregion /* IRegionModule */ | 107 | #endregion /* IRegionModule */ |
108 | 108 | ||
109 | #region IInterregionComms | 109 | #region IInterregionComms |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Agent-related communications | 112 | * Agent-related communications |
113 | */ | 113 | */ |
114 | 114 | ||
115 | public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit) | 115 | public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit) |
116 | { | 116 | { |
117 | foreach (Scene s in m_sceneList) | 117 | foreach (Scene s in m_sceneList) |
118 | { | 118 | { |
119 | if (s.RegionInfo.RegionHandle == regionHandle) | 119 | if (s.RegionInfo.RegionHandle == regionHandle) |
120 | { | 120 | { |
121 | // m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); | 121 | // m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); |
122 | s.NewUserConnection(aCircuit); | 122 | s.NewUserConnection(aCircuit); |
123 | return true; | 123 | return true; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); | 127 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); |
128 | return false; | 128 | return false; |
129 | } | 129 | } |
130 | 130 | ||
131 | public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) | 131 | public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) |
132 | { | 132 | { |
133 | foreach (Scene s in m_sceneList) | 133 | foreach (Scene s in m_sceneList) |
134 | { | 134 | { |
135 | if (s.RegionInfo.RegionHandle == regionHandle) | 135 | if (s.RegionInfo.RegionHandle == regionHandle) |
136 | { | 136 | { |
137 | //m_log.DebugFormat( | 137 | //m_log.DebugFormat( |
138 | // "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate", | 138 | // "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate", |
139 | // s.RegionInfo.RegionName, regionHandle); | 139 | // s.RegionInfo.RegionName, regionHandle); |
140 | 140 | ||
141 | s.IncomingChildAgentDataUpdate(cAgentData); | 141 | s.IncomingChildAgentDataUpdate(cAgentData); |
142 | return true; | 142 | return true; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); | 146 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); |
147 | return false; | 147 | return false; |
148 | } | 148 | } |
149 | 149 | ||
150 | public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData) | 150 | public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData) |
151 | { | 151 | { |
152 | foreach (Scene s in m_sceneList) | 152 | foreach (Scene s in m_sceneList) |
153 | { | 153 | { |
154 | if (s.RegionInfo.RegionHandle == regionHandle) | 154 | if (s.RegionInfo.RegionHandle == regionHandle) |
155 | { | 155 | { |
156 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | 156 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); |
157 | s.IncomingChildAgentDataUpdate(cAgentData); | 157 | s.IncomingChildAgentDataUpdate(cAgentData); |
158 | return true; | 158 | return true; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); | 161 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); |
162 | return false; | 162 | return false; |
163 | } | 163 | } |
164 | 164 | ||
165 | public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri) | 165 | public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri) |
166 | { | 166 | { |
167 | //uint x, y; | 167 | //uint x, y; |
168 | //Utils.LongToUInts(regionHandle, out x, out y); | 168 | //Utils.LongToUInts(regionHandle, out x, out y); |
169 | //x = x / Constants.RegionSize; | 169 | //x = x / Constants.RegionSize; |
170 | //y = y / Constants.RegionSize; | 170 | //y = y / Constants.RegionSize; |
171 | //Console.WriteLine("\n >>> Local SendReleaseAgent " + x + "-" + y); | 171 | //Console.WriteLine("\n >>> Local SendReleaseAgent " + x + "-" + y); |
172 | foreach (Scene s in m_sceneList) | 172 | foreach (Scene s in m_sceneList) |
173 | { | 173 | { |
174 | if (s.RegionInfo.RegionHandle == regionHandle) | 174 | if (s.RegionInfo.RegionHandle == regionHandle) |
175 | { | 175 | { |
176 | //m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); | 176 | //m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); |
177 | return s.IncomingReleaseAgent(id); | 177 | return s.IncomingReleaseAgent(id); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | //m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent"); | 180 | //m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent"); |
181 | return false; | 181 | return false; |
182 | } | 182 | } |
183 | 183 | ||
184 | public bool SendCloseAgent(ulong regionHandle, UUID id) | 184 | public bool SendCloseAgent(ulong regionHandle, UUID id) |
185 | { | 185 | { |
186 | //uint x, y; | 186 | //uint x, y; |
187 | //Utils.LongToUInts(regionHandle, out x, out y); | 187 | //Utils.LongToUInts(regionHandle, out x, out y); |
188 | //x = x / Constants.RegionSize; | 188 | //x = x / Constants.RegionSize; |
189 | //y = y / Constants.RegionSize; | 189 | //y = y / Constants.RegionSize; |
190 | //Console.WriteLine("\n >>> Local SendCloseAgent " + x + "-" + y); | 190 | //Console.WriteLine("\n >>> Local SendCloseAgent " + x + "-" + y); |
191 | foreach (Scene s in m_sceneList) | 191 | foreach (Scene s in m_sceneList) |
192 | { | 192 | { |
193 | if (s.RegionInfo.RegionHandle == regionHandle) | 193 | if (s.RegionInfo.RegionHandle == regionHandle) |
194 | { | 194 | { |
195 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | 195 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); |
196 | return s.IncomingCloseAgent(id); | 196 | return s.IncomingCloseAgent(id); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | 199 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); |
200 | return false; | 200 | return false; |
201 | } | 201 | } |
202 | 202 | ||
203 | /** | 203 | /** |
204 | * Object-related communications | 204 | * Object-related communications |
205 | */ | 205 | */ |
206 | 206 | ||
207 | public bool SendCreateObject(ulong regionHandle, ISceneObject sog) | 207 | public bool SendCreateObject(ulong regionHandle, ISceneObject sog) |
208 | { | 208 | { |
209 | foreach (Scene s in m_sceneList) | 209 | foreach (Scene s in m_sceneList) |
210 | { | 210 | { |
211 | if (s.RegionInfo.RegionHandle == regionHandle) | 211 | if (s.RegionInfo.RegionHandle == regionHandle) |
212 | { | 212 | { |
213 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); | 213 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); |
214 | ISceneObject sogClone = sog.CloneForNewScene(); | 214 | ISceneObject sogClone = sog.CloneForNewScene(); |
215 | return s.IncomingCreateObject(sogClone); | 215 | return s.IncomingCreateObject(sogClone); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | return false; | 218 | return false; |
219 | } | 219 | } |
220 | 220 | ||
221 | #endregion /* IInterregionComms */ | 221 | #endregion /* IInterregionComms */ |
222 | 222 | ||
223 | #region Misc | 223 | #region Misc |
224 | 224 | ||
225 | public UUID GetRegionID(ulong regionhandle) | 225 | public UUID GetRegionID(ulong regionhandle) |
226 | { | 226 | { |
227 | foreach (Scene s in m_sceneList) | 227 | foreach (Scene s in m_sceneList) |
228 | { | 228 | { |
229 | if (s.RegionInfo.RegionHandle == regionhandle) | 229 | if (s.RegionInfo.RegionHandle == regionhandle) |
230 | return s.RegionInfo.RegionID; | 230 | return s.RegionInfo.RegionID; |
231 | } | 231 | } |
232 | // ? weird. should not happen | 232 | // ? weird. should not happen |
233 | return m_sceneList[0].RegionInfo.RegionID; | 233 | return m_sceneList[0].RegionInfo.RegionID; |
234 | } | 234 | } |
235 | #endregion | 235 | #endregion |
236 | } | 236 | } |
237 | } | 237 | } |
diff --git a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs index 3574b39..afc3441 100644 --- a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs | |||
@@ -24,23 +24,23 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System; | 27 | using System; |
28 | using System.Collections; | 28 | using System.Collections; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text; | 32 | using System.Text; |
33 | using log4net; | 33 | using log4net; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Region.CoreModules.Communications.Local; | 39 | using OpenSim.Region.CoreModules.Communications.Local; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.Framework.Scenes.Hypergrid; | 42 | using OpenSim.Region.Framework.Scenes.Hypergrid; |
43 | 43 | ||
44 | namespace OpenSim.Region.CoreModules.Communications.REST | 44 | namespace OpenSim.Region.CoreModules.Communications.REST |
45 | { | 45 | { |
46 | public class RESTInterregionComms : IRegionModule, IInterregionCommsOut | 46 | public class RESTInterregionComms : IRegionModule, IInterregionCommsOut |