aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs')
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs570
1 files changed, 285 insertions, 285 deletions
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
index 23258df..a29edb4 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
@@ -1,285 +1,285 @@
1/** 1/**
2 * Copyright (c) 2008, Contributors. All rights reserved. 2 * Copyright (c) 2008, Contributors. All rights reserved.
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 modification, 5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met: 6 * are permitted provided that the following conditions are met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright notice, 8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice, 10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation 11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution. 12 * and/or other materials provided with the distribution.
13 * * Neither the name of the Organizations nor the names of Individual 13 * * Neither the name of the Organizations nor the names of Individual
14 * Contributors may be used to endorse or promote products derived from 14 * Contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission. 15 * this software without specific prior written permission.
16 * 16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32 32
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37using OpenSim.Region.Communications.OGS1; 37using OpenSim.Region.Communications.OGS1;
38using OpenSim.Region.Environment.Scenes; 38using OpenSim.Region.Environment.Scenes;
39 39
40using OpenMetaverse; 40using OpenMetaverse;
41 41
42using log4net; 42using log4net;
43 43
44namespace OpenSim.Region.Communications.Hypergrid 44namespace OpenSim.Region.Communications.Hypergrid
45{ 45{
46 public class HGGridServicesGridMode : HGGridServices 46 public class HGGridServicesGridMode : HGGridServices
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 /// <summary> 50 /// <summary>
51 /// Encapsulate remote backend services for manipulation of grid regions 51 /// Encapsulate remote backend services for manipulation of grid regions
52 /// </summary> 52 /// </summary>
53 private OGS1GridServices m_remoteBackend = null; 53 private OGS1GridServices m_remoteBackend = null;
54 54
55 public OGS1GridServices RemoteBackend 55 public OGS1GridServices RemoteBackend
56 { 56 {
57 get { return m_remoteBackend; } 57 get { return m_remoteBackend; }
58 } 58 }
59 59
60 60
61 public override string gdebugRegionName 61 public override string gdebugRegionName
62 { 62 {
63 get { return m_remoteBackend.gdebugRegionName; } 63 get { return m_remoteBackend.gdebugRegionName; }
64 set { m_remoteBackend.gdebugRegionName = value; } 64 set { m_remoteBackend.gdebugRegionName = value; }
65 } 65 }
66 66
67 public override bool RegionLoginsEnabled 67 public override bool RegionLoginsEnabled
68 { 68 {
69 get { return m_remoteBackend.RegionLoginsEnabled; } 69 get { return m_remoteBackend.RegionLoginsEnabled; }
70 set { m_remoteBackend.RegionLoginsEnabled = value; } 70 set { m_remoteBackend.RegionLoginsEnabled = value; }
71 } 71 }
72 72
73 public HGGridServicesGridMode(NetworkServersInfo servers_info, BaseHttpServer httpServe, 73 public HGGridServicesGridMode(NetworkServersInfo servers_info, BaseHttpServer httpServe,
74 AssetCache asscache, SceneManager sman, UserProfileCacheService userv) 74 AssetCache asscache, SceneManager sman, UserProfileCacheService userv)
75 : base(servers_info, httpServe, asscache, sman) 75 : base(servers_info, httpServe, asscache, sman)
76 { 76 {
77 m_remoteBackend = new OGS1GridServices(servers_info, httpServe); 77 m_remoteBackend = new OGS1GridServices(servers_info, httpServe);
78 // Let's deregister this, so we can handle it here first 78 // Let's deregister this, so we can handle it here first
79 InterRegionSingleton.Instance.OnChildAgent -= m_remoteBackend.IncomingChildAgent; 79 InterRegionSingleton.Instance.OnChildAgent -= m_remoteBackend.IncomingChildAgent;
80 InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; 80 InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent;
81 m_userProfileCache = userv; 81 m_userProfileCache = userv;
82 } 82 }
83 83
84 #region IGridServices interface 84 #region IGridServices interface
85 85
86 public override RegionCommsListener RegisterRegion(RegionInfo regionInfo) 86 public override RegionCommsListener RegisterRegion(RegionInfo regionInfo)
87 { 87 {
88 if (!regionInfo.RegionID.Equals(UUID.Zero)) 88 if (!regionInfo.RegionID.Equals(UUID.Zero))
89 { 89 {
90 m_regionsOnInstance.Add(regionInfo); 90 m_regionsOnInstance.Add(regionInfo);
91 return m_remoteBackend.RegisterRegion(regionInfo); 91 return m_remoteBackend.RegisterRegion(regionInfo);
92 } 92 }
93 else 93 else
94 return base.RegisterRegion(regionInfo); 94 return base.RegisterRegion(regionInfo);
95 } 95 }
96 96
97 public override bool DeregisterRegion(RegionInfo regionInfo) 97 public override bool DeregisterRegion(RegionInfo regionInfo)
98 { 98 {
99 bool success = m_remoteBackend.DeregisterRegion(regionInfo); 99 bool success = m_remoteBackend.DeregisterRegion(regionInfo);
100 if (!success) 100 if (!success)
101 success = base.DeregisterRegion(regionInfo); 101 success = base.DeregisterRegion(regionInfo);
102 return success; 102 return success;
103 } 103 }
104 104
105 public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) 105 public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
106 { 106 {
107 List<SimpleRegionInfo> neighbours = m_remoteBackend.RequestNeighbours(x, y); 107 List<SimpleRegionInfo> neighbours = m_remoteBackend.RequestNeighbours(x, y);
108 List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y); 108 List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y);
109 neighbours.AddRange(remotes); 109 neighbours.AddRange(remotes);
110 110
111 return neighbours; 111 return neighbours;
112 } 112 }
113 113
114 public override RegionInfo RequestNeighbourInfo(UUID Region_UUID) 114 public override RegionInfo RequestNeighbourInfo(UUID Region_UUID)
115 { 115 {
116 RegionInfo info = m_remoteBackend.RequestNeighbourInfo(Region_UUID); 116 RegionInfo info = m_remoteBackend.RequestNeighbourInfo(Region_UUID);
117 if (info == null) 117 if (info == null)
118 info = base.RequestNeighbourInfo(Region_UUID); 118 info = base.RequestNeighbourInfo(Region_UUID);
119 return info; 119 return info;
120 } 120 }
121 121
122 public override RegionInfo RequestNeighbourInfo(ulong regionHandle) 122 public override RegionInfo RequestNeighbourInfo(ulong regionHandle)
123 { 123 {
124 RegionInfo info = m_remoteBackend.RequestNeighbourInfo(regionHandle); 124 RegionInfo info = m_remoteBackend.RequestNeighbourInfo(regionHandle);
125 if (info == null) 125 if (info == null)
126 info = base.RequestNeighbourInfo(regionHandle); 126 info = base.RequestNeighbourInfo(regionHandle);
127 return info; 127 return info;
128 } 128 }
129 129
130 public override RegionInfo RequestClosestRegion(string regionName) 130 public override RegionInfo RequestClosestRegion(string regionName)
131 { 131 {
132 RegionInfo info = m_remoteBackend.RequestClosestRegion(regionName); 132 RegionInfo info = m_remoteBackend.RequestClosestRegion(regionName);
133 if (info == null) 133 if (info == null)
134 info = base.RequestClosestRegion(regionName); 134 info = base.RequestClosestRegion(regionName);
135 return info; 135 return info;
136 } 136 }
137 137
138 public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) 138 public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
139 { 139 {
140 List<MapBlockData> neighbours = m_remoteBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); 140 List<MapBlockData> neighbours = m_remoteBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
141 List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); 141 List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
142 neighbours.AddRange(remotes); 142 neighbours.AddRange(remotes);
143 143
144 return neighbours; 144 return neighbours;
145 } 145 }
146 146
147 public override LandData RequestLandData(ulong regionHandle, uint x, uint y) 147 public override LandData RequestLandData(ulong regionHandle, uint x, uint y)
148 { 148 {
149 LandData land = m_remoteBackend.RequestLandData(regionHandle, x, y); 149 LandData land = m_remoteBackend.RequestLandData(regionHandle, x, y);
150 if (land == null) 150 if (land == null)
151 land = base.RequestLandData(regionHandle, x, y); 151 land = base.RequestLandData(regionHandle, x, y);
152 return land; 152 return land;
153 } 153 }
154 154
155 public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber) 155 public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber)
156 { 156 {
157 List<RegionInfo> infos = m_remoteBackend.RequestNamedRegions(name, maxNumber); 157 List<RegionInfo> infos = m_remoteBackend.RequestNamedRegions(name, maxNumber);
158 List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber); 158 List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber);
159 infos.AddRange(remotes); 159 infos.AddRange(remotes);
160 return infos; 160 return infos;
161 } 161 }
162 162
163 #endregion 163 #endregion
164 164
165 #region IInterRegionCommunications interface 165 #region IInterRegionCommunications interface
166 166
167 public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) 167 public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId)
168 { 168 {
169 return m_remoteBackend.AcknowledgeAgentCrossed(regionHandle, agentId); 169 return m_remoteBackend.AcknowledgeAgentCrossed(regionHandle, agentId);
170 } 170 }
171 171
172 public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID) 172 public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID)
173 { 173 {
174 return m_remoteBackend.AcknowledgePrimCrossed(regionHandle, primID); 174 return m_remoteBackend.AcknowledgePrimCrossed(regionHandle, primID);
175 } 175 }
176 176
177 public override bool CheckRegion(string address, uint port) 177 public override bool CheckRegion(string address, uint port)
178 { 178 {
179 return m_remoteBackend.CheckRegion(address, port); 179 return m_remoteBackend.CheckRegion(address, port);
180 } 180 }
181 181
182 public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) 182 public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
183 { 183 {
184 return m_remoteBackend.ChildAgentUpdate(regionHandle, cAgentData); 184 return m_remoteBackend.ChildAgentUpdate(regionHandle, cAgentData);
185 } 185 }
186 186
187 public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) 187 public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
188 { 188 {
189 if (base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying)) 189 if (base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying))
190 return true; 190 return true;
191 return m_remoteBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); 191 return m_remoteBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
192 } 192 }
193 193
194 public override bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) 194 public override bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying)
195 { 195 {
196 return m_remoteBackend.ExpectPrimCrossing(regionHandle, primID, position, isFlying); 196 return m_remoteBackend.ExpectPrimCrossing(regionHandle, primID, position, isFlying);
197 } 197 }
198 198
199 public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) 199 public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
200 { 200 {
201 CachedUserInfo user = m_userProfileCache.GetUserDetails(agentData.AgentID); 201 CachedUserInfo user = m_userProfileCache.GetUserDetails(agentData.AgentID);
202 202
203 if (IsLocalUser(user)) 203 if (IsLocalUser(user))
204 { 204 {
205 Console.WriteLine("XXX Home User XXX"); 205 Console.WriteLine("XXX Home User XXX");
206 if (IsHyperlinkRegion(regionHandle)) 206 if (IsHyperlinkRegion(regionHandle))
207 { 207 {
208 Console.WriteLine("XXX Going Hyperlink XXX"); 208 Console.WriteLine("XXX Going Hyperlink XXX");
209 return base.InformRegionOfChildAgent(regionHandle, agentData); 209 return base.InformRegionOfChildAgent(regionHandle, agentData);
210 } 210 }
211 else 211 else
212 { 212 {
213 // non-hypergrid case 213 // non-hypergrid case
214 Console.WriteLine("XXX Going local-grid region XXX"); 214 Console.WriteLine("XXX Going local-grid region XXX");
215 return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); 215 return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData);
216 } 216 }
217 } 217 }
218 218
219 // Foregin users 219 // Foregin users
220 Console.WriteLine("XXX Foreign User XXX"); 220 Console.WriteLine("XXX Foreign User XXX");
221 if (IsLocalRegion(regionHandle)) // regions on the same instance 221 if (IsLocalRegion(regionHandle)) // regions on the same instance
222 { 222 {
223 Console.WriteLine("XXX Going onInstance region XXX"); 223 Console.WriteLine("XXX Going onInstance region XXX");
224 return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); 224 return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData);
225 } 225 }
226 226
227 if (IsHyperlinkRegion(regionHandle)) // hyperlinked regions 227 if (IsHyperlinkRegion(regionHandle)) // hyperlinked regions
228 { 228 {
229 Console.WriteLine("XXX Going Hyperlink XXX"); 229 Console.WriteLine("XXX Going Hyperlink XXX");
230 return base.InformRegionOfChildAgent(regionHandle, agentData); 230 return base.InformRegionOfChildAgent(regionHandle, agentData);
231 } 231 }
232 else 232 else
233 { 233 {
234 // foreign user going to a non-local region on the same grid 234 // foreign user going to a non-local region on the same grid
235 // We need to inform that region about this user before 235 // We need to inform that region about this user before
236 // proceeding to the normal backend process. 236 // proceeding to the normal backend process.
237 Console.WriteLine("XXX Going local-grid region XXX"); 237 Console.WriteLine("XXX Going local-grid region XXX");
238 RegionInfo regInfo = RequestNeighbourInfo(regionHandle); 238 RegionInfo regInfo = RequestNeighbourInfo(regionHandle);
239 if (regInfo != null) 239 if (regInfo != null)
240 InformRegionOfUser(regInfo, agentData); 240 InformRegionOfUser(regInfo, agentData);
241 return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); 241 return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData);
242 } 242 }
243 243
244 } 244 }
245 245
246 public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) 246 public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod)
247 { 247 {
248 return m_remoteBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod); 248 return m_remoteBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod);
249 } 249 }
250 250
251 public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle) 251 public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle)
252 { 252 {
253 if (m_remoteBackend.RegionUp(region, regionhandle)) 253 if (m_remoteBackend.RegionUp(region, regionhandle))
254 return true; 254 return true;
255 return base.RegionUp(region, regionhandle); 255 return base.RegionUp(region, regionhandle);
256 } 256 }
257 257
258 public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) 258 public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID)
259 { 259 {
260 return m_remoteBackend.TellRegionToCloseChildConnection(regionHandle, agentID); 260 return m_remoteBackend.TellRegionToCloseChildConnection(regionHandle, agentID);
261 } 261 }
262 262
263 263
264 #endregion 264 #endregion
265 265
266 #region Methods triggered by calls from external instances 266 #region Methods triggered by calls from external instances
267 267
268 /// <summary> 268 /// <summary>
269 /// 269 ///
270 /// </summary> 270 /// </summary>
271 /// <param name="regionHandle"></param> 271 /// <param name="regionHandle"></param>
272 /// <param name="agentData"></param> 272 /// <param name="agentData"></param>
273 /// <returns></returns> 273 /// <returns></returns>
274 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) 274 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
275 { 275 {
276 HGIncomingChildAgent(regionHandle, agentData); 276 HGIncomingChildAgent(regionHandle, agentData);
277 277
278 m_log.Info("[HGrid]: Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname); 278 m_log.Info("[HGrid]: Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname);
279 279
280 return m_remoteBackend.IncomingChildAgent(regionHandle, agentData); 280 return m_remoteBackend.IncomingChildAgent(regionHandle, agentData);
281 } 281 }
282 #endregion 282 #endregion
283 283
284 } 284 }
285} 285}