diff options
author | Diva Canto | 2010-01-17 11:33:47 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-17 11:33:47 -0800 |
commit | f276ba57bf5bd732fbc6a255213c9bb7f5f5f148 (patch) | |
tree | 65c49c571c4012b195a309866b8bf6ed2885f9ef /OpenSim | |
parent | Copyright notices. (diff) | |
download | opensim-SC-f276ba57bf5bd732fbc6a255213c9bb7f5f5f148.zip opensim-SC-f276ba57bf5bd732fbc6a255213c9bb7f5f5f148.tar.gz opensim-SC-f276ba57bf5bd732fbc6a255213c9bb7f5f5f148.tar.bz2 opensim-SC-f276ba57bf5bd732fbc6a255213c9bb7f5f5f148.tar.xz |
HG agent transfers are starting to work. Gatekeeper handlers are missing.
Diffstat (limited to '')
10 files changed, 354 insertions, 257 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 827dafe..d0171fe 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
61 | get { return null; } | 61 | get { return null; } |
62 | } | 62 | } |
63 | 63 | ||
64 | public string Name | 64 | public virtual string Name |
65 | { | 65 | { |
66 | get { return "BasicEntityTransferModule"; } | 66 | get { return "BasicEntityTransferModule"; } |
67 | } | 67 | } |
@@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
76 | { | 76 | { |
77 | m_agentsInTransit = new List<UUID>(); | 77 | m_agentsInTransit = new List<UUID>(); |
78 | m_Enabled = true; | 78 | m_Enabled = true; |
79 | m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} nabled.", Name); | 79 | m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | } | 82 | } |
@@ -135,296 +135,312 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
135 | // Reset animations; the viewer does that in teleports. | 135 | // Reset animations; the viewer does that in teleports. |
136 | sp.Animator.ResetAnimations(); | 136 | sp.Animator.ResetAnimations(); |
137 | 137 | ||
138 | if (regionHandle == sp.Scene.RegionInfo.RegionHandle) | 138 | try |
139 | { | 139 | { |
140 | m_log.DebugFormat( | 140 | if (regionHandle == sp.Scene.RegionInfo.RegionHandle) |
141 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}", | ||
142 | position, sp.Scene.RegionInfo.RegionName); | ||
143 | |||
144 | // Teleport within the same region | ||
145 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) | ||
146 | { | ||
147 | Vector3 emergencyPos = new Vector3(128, 128, 128); | ||
148 | |||
149 | m_log.WarnFormat( | ||
150 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", | ||
151 | position, sp.Name, sp.UUID, emergencyPos); | ||
152 | position = emergencyPos; | ||
153 | } | ||
154 | |||
155 | // TODO: Get proper AVG Height | ||
156 | float localAVHeight = 1.56f; | ||
157 | float posZLimit = 22; | ||
158 | |||
159 | // TODO: Check other Scene HeightField | ||
160 | if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <= (int)Constants.RegionSize) | ||
161 | { | 141 | { |
162 | posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; | 142 | m_log.DebugFormat( |
163 | } | 143 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}", |
164 | 144 | position, sp.Scene.RegionInfo.RegionName); | |
165 | float newPosZ = posZLimit + localAVHeight; | ||
166 | if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) | ||
167 | { | ||
168 | position.Z = newPosZ; | ||
169 | } | ||
170 | 145 | ||
171 | // Only send this if the event queue is null | 146 | // Teleport within the same region |
172 | if (eq == null) | 147 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) |
173 | sp.ControllingClient.SendTeleportLocationStart(); | 148 | { |
149 | Vector3 emergencyPos = new Vector3(128, 128, 128); | ||
174 | 150 | ||
175 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 151 | m_log.WarnFormat( |
176 | sp.Teleport(position); | 152 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", |
177 | } | 153 | position, sp.Name, sp.UUID, emergencyPos); |
178 | else | 154 | position = emergencyPos; |
179 | { | 155 | } |
180 | uint x = 0, y = 0; | ||
181 | Utils.LongToUInts(regionHandle, out x, out y); | ||
182 | GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); | ||
183 | 156 | ||
184 | if (reg != null) | 157 | // TODO: Get proper AVG Height |
185 | { | 158 | float localAVHeight = 1.56f; |
186 | m_log.DebugFormat( | 159 | float posZLimit = 22; |
187 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation to {0} in {1}", | ||
188 | position, reg.RegionName); | ||
189 | 160 | ||
190 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 161 | // TODO: Check other Scene HeightField |
191 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | 162 | if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <= (int)Constants.RegionSize) |
192 | uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40); | 163 | { |
193 | uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8); | 164 | posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; |
165 | } | ||
194 | 166 | ||
195 | ulong destinationHandle = GetRegionHandle(reg); | 167 | float newPosZ = posZLimit + localAVHeight; |
196 | GridRegion finalDestination = GetFinalDestination(reg); | 168 | if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) |
169 | { | ||
170 | position.Z = newPosZ; | ||
171 | } | ||
197 | 172 | ||
173 | // Only send this if the event queue is null | ||
198 | if (eq == null) | 174 | if (eq == null) |
199 | sp.ControllingClient.SendTeleportLocationStart(); | 175 | sp.ControllingClient.SendTeleportLocationStart(); |
200 | 176 | ||
201 | // Let's do DNS resolution only once in this process, please! | 177 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
202 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 178 | sp.Teleport(position); |
203 | // it's actually doing a lot of work. | 179 | } |
204 | IPEndPoint endPoint = reg.ExternalEndPoint; | 180 | else |
205 | if (endPoint.Address == null) | 181 | { |
206 | { | 182 | uint x = 0, y = 0; |
207 | // Couldn't resolve the name. Can't TP, because the viewer wants IP addresses. | 183 | Utils.LongToUInts(regionHandle, out x, out y); |
208 | destRegionUp = false; | 184 | GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); |
209 | } | ||
210 | 185 | ||
211 | if (destRegionUp) | 186 | if (reg != null) |
212 | { | 187 | { |
213 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 188 | m_log.DebugFormat( |
214 | // both regions | 189 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation to {0} in {1}", |
215 | if (sp.ParentID != (uint)0) | 190 | position, reg.RegionName); |
216 | sp.StandUp(); | 191 | |
192 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | ||
193 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | ||
194 | uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40); | ||
195 | uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8); | ||
217 | 196 | ||
218 | if (!sp.ValidateAttachments()) | 197 | GridRegion finalDestination = GetFinalDestination(reg); |
198 | if (finalDestination == null) | ||
219 | { | 199 | { |
220 | sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | 200 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport agent."); |
201 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); | ||
221 | return; | 202 | return; |
222 | } | 203 | } |
204 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", finalDestination.RegionLocX, finalDestination.RegionLocY, finalDestination.RegionID); | ||
205 | ulong destinationHandle = finalDestination.RegionHandle; | ||
223 | 206 | ||
224 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | 207 | if (eq == null) |
225 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | 208 | sp.ControllingClient.SendTeleportLocationStart(); |
226 | //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); | 209 | |
227 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | 210 | // Let's do DNS resolution only once in this process, please! |
228 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | 211 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
229 | // once we reach here... | 212 | // it's actually doing a lot of work. |
230 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | 213 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
231 | 214 | if (endPoint.Address == null) | |
232 | string capsPath = String.Empty; | ||
233 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); | ||
234 | agentCircuit.BaseFolder = UUID.Zero; | ||
235 | agentCircuit.InventoryFolder = UUID.Zero; | ||
236 | agentCircuit.startpos = position; | ||
237 | agentCircuit.child = true; | ||
238 | agentCircuit.Appearance = sp.Appearance; | ||
239 | |||
240 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
241 | { | 215 | { |
242 | // brand new agent, let's create a new caps seed | 216 | // Couldn't resolve the name. Can't TP, because the viewer wants IP addresses. |
243 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 217 | destRegionUp = false; |
244 | } | 218 | } |
245 | 219 | ||
246 | string reason = String.Empty; | 220 | if (destRegionUp) |
247 | |||
248 | // Let's create an agent there if one doesn't exist yet. | ||
249 | if (!m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason)) | ||
250 | { | 221 | { |
251 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", | 222 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
252 | reason)); | 223 | // both regions |
253 | return; | 224 | if (sp.ParentID != (uint)0) |
254 | } | 225 | sp.StandUp(); |
255 | 226 | ||
256 | // OK, it got this agent. Let's close some child agents | 227 | if (!sp.ValidateAttachments()) |
257 | sp.CloseChildAgents(newRegionX, newRegionY); | 228 | { |
229 | sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | ||
230 | return; | ||
231 | } | ||
258 | 232 | ||
259 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 233 | // the avatar.Close below will clear the child region list. We need this below for (possibly) |
260 | { | 234 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). |
261 | #region IP Translation for NAT | 235 | //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); |
262 | IClientIPEndpoint ipepClient; | 236 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport |
263 | if (sp.ClientView.TryGet(out ipepClient)) | 237 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail |
238 | // once we reach here... | ||
239 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | ||
240 | |||
241 | string capsPath = String.Empty; | ||
242 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); | ||
243 | agentCircuit.BaseFolder = UUID.Zero; | ||
244 | agentCircuit.InventoryFolder = UUID.Zero; | ||
245 | agentCircuit.startpos = position; | ||
246 | agentCircuit.child = true; | ||
247 | agentCircuit.Appearance = sp.Appearance; | ||
248 | |||
249 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
264 | { | 250 | { |
265 | capsPath | 251 | // brand new agent, let's create a new caps seed |
266 | = "http://" | 252 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
267 | + NetworkUtil.GetHostFor(ipepClient.EndPoint, reg.ExternalHostName) | ||
268 | + ":" | ||
269 | + reg.HttpPort | ||
270 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
271 | } | 253 | } |
272 | else | 254 | |
255 | string reason = String.Empty; | ||
256 | |||
257 | // Let's create an agent there if one doesn't exist yet. | ||
258 | if (!m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason)) | ||
273 | { | 259 | { |
274 | capsPath | 260 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", |
275 | = "http://" | 261 | reason)); |
276 | + reg.ExternalHostName | 262 | return; |
277 | + ":" | ||
278 | + reg.HttpPort | ||
279 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
280 | } | 263 | } |
281 | #endregion | ||
282 | 264 | ||
283 | if (eq != null) | 265 | // OK, it got this agent. Let's close some child agents |
266 | sp.CloseChildAgents(newRegionX, newRegionY); | ||
267 | |||
268 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
284 | { | 269 | { |
285 | #region IP Translation for NAT | 270 | #region IP Translation for NAT |
286 | // Uses ipepClient above | 271 | IClientIPEndpoint ipepClient; |
287 | if (sp.ClientView.TryGet(out ipepClient)) | 272 | if (sp.ClientView.TryGet(out ipepClient)) |
288 | { | 273 | { |
289 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | 274 | capsPath |
275 | = "http://" | ||
276 | + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName) | ||
277 | + ":" | ||
278 | + finalDestination.HttpPort | ||
279 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | capsPath | ||
284 | = "http://" | ||
285 | + finalDestination.ExternalHostName | ||
286 | + ":" | ||
287 | + finalDestination.HttpPort | ||
288 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
290 | } | 289 | } |
291 | #endregion | 290 | #endregion |
292 | 291 | ||
293 | eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); | 292 | if (eq != null) |
293 | { | ||
294 | #region IP Translation for NAT | ||
295 | // Uses ipepClient above | ||
296 | if (sp.ClientView.TryGet(out ipepClient)) | ||
297 | { | ||
298 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
299 | } | ||
300 | #endregion | ||
301 | |||
302 | eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); | ||
294 | 303 | ||
295 | // ES makes the client send a UseCircuitCode message to the destination, | 304 | // ES makes the client send a UseCircuitCode message to the destination, |
296 | // which triggers a bunch of things there. | 305 | // which triggers a bunch of things there. |
297 | // So let's wait | 306 | // So let's wait |
298 | Thread.Sleep(2000); | 307 | Thread.Sleep(2000); |
299 | 308 | ||
300 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); | 309 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); |
301 | 310 | ||
311 | } | ||
312 | else | ||
313 | { | ||
314 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); | ||
315 | } | ||
302 | } | 316 | } |
303 | else | 317 | else |
304 | { | 318 | { |
305 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); | 319 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); |
320 | capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort | ||
321 | + "/CAPS/" + agentCircuit.CapsPath + "0000/"; | ||
306 | } | 322 | } |
307 | } | ||
308 | else | ||
309 | { | ||
310 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); | ||
311 | capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort | ||
312 | + "/CAPS/" + agentCircuit.CapsPath + "0000/"; | ||
313 | } | ||
314 | |||
315 | // Expect avatar crossing is a heavy-duty function at the destination. | ||
316 | // That is where MakeRoot is called, which fetches appearance and inventory. | ||
317 | // Plus triggers OnMakeRoot, which spawns a series of asynchronous updates. | ||
318 | //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | ||
319 | // position, false); | ||
320 | |||
321 | //{ | ||
322 | // avatar.ControllingClient.SendTeleportFailed("Problem with destination."); | ||
323 | // // We should close that agent we just created over at destination... | ||
324 | // List<ulong> lst = new List<ulong>(); | ||
325 | // lst.Add(reg.RegionHandle); | ||
326 | // SendCloseChildAgentAsync(avatar.UUID, lst); | ||
327 | // return; | ||
328 | //} | ||
329 | 323 | ||
330 | SetInTransit(sp.UUID); | 324 | // Expect avatar crossing is a heavy-duty function at the destination. |
325 | // That is where MakeRoot is called, which fetches appearance and inventory. | ||
326 | // Plus triggers OnMakeRoot, which spawns a series of asynchronous updates. | ||
327 | //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | ||
328 | // position, false); | ||
329 | |||
330 | //{ | ||
331 | // avatar.ControllingClient.SendTeleportFailed("Problem with destination."); | ||
332 | // // We should close that agent we just created over at destination... | ||
333 | // List<ulong> lst = new List<ulong>(); | ||
334 | // lst.Add(reg.RegionHandle); | ||
335 | // SendCloseChildAgentAsync(avatar.UUID, lst); | ||
336 | // return; | ||
337 | //} | ||
338 | |||
339 | SetInTransit(sp.UUID); | ||
340 | |||
341 | // Let's send a full update of the agent. This is a synchronous call. | ||
342 | AgentData agent = new AgentData(); | ||
343 | sp.CopyTo(agent); | ||
344 | agent.Position = position; | ||
345 | agent.CallbackURI = "http://" + sp.Scene.RegionInfo.ExternalHostName + ":" + sp.Scene.RegionInfo.HttpPort + | ||
346 | "/agent/" + sp.UUID.ToString() + "/" + sp.Scene.RegionInfo.RegionID.ToString() + "/release/"; | ||
347 | |||
348 | // Straight to the region. Safe. | ||
349 | m_aScene.SimulationService.UpdateAgent(reg, agent); | ||
331 | 350 | ||
332 | // Let's send a full update of the agent. This is a synchronous call. | 351 | m_log.DebugFormat( |
333 | AgentData agent = new AgentData(); | 352 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); |
334 | sp.CopyTo(agent); | ||
335 | agent.Position = position; | ||
336 | agent.CallbackURI = "http://" + sp.Scene.RegionInfo.ExternalHostName + ":" + sp.Scene.RegionInfo.HttpPort + | ||
337 | "/agent/" + sp.UUID.ToString() + "/" + sp.Scene.RegionInfo.RegionID.ToString() + "/release/"; | ||
338 | 353 | ||
339 | m_aScene.SimulationService.UpdateAgent(reg, agent); | ||
340 | 354 | ||
341 | m_log.DebugFormat( | 355 | if (eq != null) |
342 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); | 356 | { |
357 | eq.TeleportFinishEvent(destinationHandle, 13, endPoint, | ||
358 | 0, teleportFlags, capsPath, sp.UUID); | ||
359 | } | ||
360 | else | ||
361 | { | ||
362 | sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4, | ||
363 | teleportFlags, capsPath); | ||
364 | } | ||
343 | 365 | ||
366 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | ||
367 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | ||
368 | // that the client contacted the destination before we send the attachments and close things here. | ||
369 | if (!WaitForCallback(sp.UUID)) | ||
370 | { | ||
371 | // Client never contacted destination. Let's restore everything back | ||
372 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
344 | 373 | ||
345 | if (eq != null) | 374 | ResetFromTransit(sp.UUID); |
346 | { | ||
347 | eq.TeleportFinishEvent(destinationHandle, 13, endPoint, | ||
348 | 0, teleportFlags, capsPath, sp.UUID); | ||
349 | } | ||
350 | else | ||
351 | { | ||
352 | sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4, | ||
353 | teleportFlags, capsPath); | ||
354 | } | ||
355 | 375 | ||
356 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | 376 | // Yikes! We should just have a ref to scene here. |
357 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | 377 | //sp.Scene.InformClientOfNeighbours(sp); |
358 | // that the client contacted the destination before we send the attachments and close things here. | 378 | EnableChildAgents(sp); |
359 | if (!WaitForCallback(sp.UUID)) | ||
360 | { | ||
361 | // Client never contacted destination. Let's restore everything back | ||
362 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
363 | 379 | ||
364 | ResetFromTransit(sp.UUID); | 380 | // Finally, kill the agent we just created at the destination. |
381 | m_aScene.SimulationService.CloseAgent(reg, sp.UUID); | ||
365 | 382 | ||
366 | // Yikes! We should just have a ref to scene here. | 383 | return; |
367 | //sp.Scene.InformClientOfNeighbours(sp); | 384 | } |
368 | EnableChildAgents(sp); | ||
369 | 385 | ||
370 | // Finally, kill the agent we just created at the destination. | 386 | KillEntity(sp.Scene, sp.LocalId); |
371 | m_aScene.SimulationService.CloseAgent(reg, sp.UUID); | ||
372 | 387 | ||
373 | return; | 388 | sp.MakeChildAgent(); |
374 | } | ||
375 | 389 | ||
376 | KillEntity(sp.Scene, sp.LocalId); | 390 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it |
391 | CrossAttachmentsIntoNewRegion(reg, sp, true); | ||
377 | 392 | ||
378 | sp.MakeChildAgent(); | 393 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
379 | 394 | ||
380 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | 395 | if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
381 | CrossAttachmentsIntoNewRegion(reg, sp, true); | 396 | { |
397 | Thread.Sleep(5000); | ||
398 | sp.Close(); | ||
399 | sp.Scene.IncomingCloseAgent(sp.UUID); | ||
400 | } | ||
401 | else | ||
402 | // now we have a child agent in this region. | ||
403 | sp.Reset(); | ||
382 | 404 | ||
383 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | ||
384 | 405 | ||
385 | if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 406 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! |
386 | { | 407 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) |
387 | Thread.Sleep(5000); | 408 | { |
388 | sp.Close(); | 409 | m_log.DebugFormat( |
389 | sp.Scene.IncomingCloseAgent(sp.UUID); | 410 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", |
411 | sp.UUID); | ||
412 | } | ||
390 | } | 413 | } |
391 | else | 414 | else |
392 | // now we have a child agent in this region. | ||
393 | sp.Reset(); | ||
394 | |||
395 | |||
396 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
397 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | ||
398 | { | 415 | { |
399 | m_log.DebugFormat( | 416 | sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); |
400 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", | ||
401 | sp.UUID); | ||
402 | } | 417 | } |
403 | } | 418 | } |
404 | else | 419 | else |
405 | { | 420 | { |
406 | sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); | 421 | // TP to a place that doesn't exist (anymore) |
422 | // Inform the viewer about that | ||
423 | sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); | ||
424 | |||
425 | // and set the map-tile to '(Offline)' | ||
426 | uint regX, regY; | ||
427 | Utils.LongToUInts(regionHandle, out regX, out regY); | ||
428 | |||
429 | MapBlockData block = new MapBlockData(); | ||
430 | block.X = (ushort)(regX / Constants.RegionSize); | ||
431 | block.Y = (ushort)(regY / Constants.RegionSize); | ||
432 | block.Access = 254; // == not there | ||
433 | |||
434 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
435 | blocks.Add(block); | ||
436 | sp.ControllingClient.SendMapBlock(blocks, 0); | ||
407 | } | 437 | } |
408 | } | 438 | } |
409 | else | 439 | } |
410 | { | 440 | catch (Exception e) |
411 | // TP to a place that doesn't exist (anymore) | 441 | { |
412 | // Inform the viewer about that | 442 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0}\n{1}", e.Message, e.StackTrace); |
413 | sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); | 443 | sp.ControllingClient.SendTeleportFailed("Internal error"); |
414 | |||
415 | // and set the map-tile to '(Offline)' | ||
416 | uint regX, regY; | ||
417 | Utils.LongToUInts(regionHandle, out regX, out regY); | ||
418 | |||
419 | MapBlockData block = new MapBlockData(); | ||
420 | block.X = (ushort)(regX / Constants.RegionSize); | ||
421 | block.Y = (ushort)(regY / Constants.RegionSize); | ||
422 | block.Access = 254; // == not there | ||
423 | |||
424 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
425 | blocks.Add(block); | ||
426 | sp.ControllingClient.SendMapBlock(blocks, 0); | ||
427 | } | ||
428 | } | 444 | } |
429 | } | 445 | } |
430 | 446 | ||
@@ -433,11 +449,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
433 | scene.SendKillObject(localID); | 449 | scene.SendKillObject(localID); |
434 | } | 450 | } |
435 | 451 | ||
436 | protected virtual ulong GetRegionHandle(GridRegion region) | ||
437 | { | ||
438 | return region.RegionHandle; | ||
439 | } | ||
440 | |||
441 | protected virtual GridRegion GetFinalDestination(GridRegion region) | 452 | protected virtual GridRegion GetFinalDestination(GridRegion region) |
442 | { | 453 | { |
443 | return region; | 454 | return region; |
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 68cf060..08a90a2 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | <Extension path = "/OpenSim/RegionModules"> | 10 | <Extension path = "/OpenSim/RegionModules"> |
11 | <RegionModule id="EntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule" /> | 11 | <RegionModule id="EntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule" /> |
12 | <RegionModule id="HGEntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule" /> | ||
12 | <RegionModule id="LandManagementModule" type="OpenSim.Region.CoreModules.World.Land.LandManagementModule" /> | 13 | <RegionModule id="LandManagementModule" type="OpenSim.Region.CoreModules.World.Land.LandManagementModule" /> |
13 | <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" /> | 14 | <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" /> |
14 | <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> | 15 | <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index 773286c..07f3cdc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs | |||
@@ -48,7 +48,7 @@ using Nini.Config; | |||
48 | 48 | ||
49 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | 49 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid |
50 | { | 50 | { |
51 | public class HGGridConnector : ISharedRegionModule, IGridService | 51 | public class HGGridConnector : ISharedRegionModule, IGridService, IHypergridService |
52 | { | 52 | { |
53 | private static readonly ILog m_log = | 53 | private static readonly ILog m_log = |
54 | LogManager.GetLogger( | 54 | LogManager.GetLogger( |
@@ -148,6 +148,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
148 | 148 | ||
149 | m_LocalScenes[scene.RegionInfo.RegionHandle] = scene; | 149 | m_LocalScenes[scene.RegionInfo.RegionHandle] = scene; |
150 | scene.RegisterModuleInterface<IGridService>(this); | 150 | scene.RegisterModuleInterface<IGridService>(this); |
151 | scene.RegisterModuleInterface<IHypergridService>(this); | ||
151 | 152 | ||
152 | ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); | 153 | ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); |
153 | 154 | ||
@@ -158,6 +159,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
158 | if (m_Enabled) | 159 | if (m_Enabled) |
159 | { | 160 | { |
160 | m_LocalScenes.Remove(scene.RegionInfo.RegionHandle); | 161 | m_LocalScenes.Remove(scene.RegionInfo.RegionHandle); |
162 | scene.UnregisterModuleInterface<IGridService>(this); | ||
163 | scene.UnregisterModuleInterface<IHypergridService>(this); | ||
161 | ((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene); | 164 | ((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene); |
162 | } | 165 | } |
163 | } | 166 | } |
@@ -278,5 +281,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
278 | 281 | ||
279 | #endregion | 282 | #endregion |
280 | 283 | ||
284 | #region IHypergridService | ||
285 | |||
286 | public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason) | ||
287 | { | ||
288 | return m_HypergridService.LinkRegion(regionDescriptor, out regionID, out regionHandle, out imageURL, out reason); | ||
289 | } | ||
290 | |||
291 | public GridRegion GetHyperlinkRegion(GridRegion gateway, UUID regionID) | ||
292 | { | ||
293 | if (m_LocalScenes.ContainsKey(gateway.RegionHandle)) | ||
294 | return gateway; | ||
295 | |||
296 | return m_HypergridService.GetHyperlinkRegion(gateway, regionID); | ||
297 | } | ||
298 | |||
299 | public GridRegion GetRegionByUUID(UUID regionID) { return null; } | ||
300 | public GridRegion GetRegionByPosition(int x, int y) { return null; } | ||
301 | public GridRegion GetRegionByName(string name) { return null; } | ||
302 | public List<GridRegion> GetRegionsByName(string name) { return null; } | ||
303 | public List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax) { return null; } | ||
304 | |||
305 | #endregion | ||
281 | } | 306 | } |
282 | } | 307 | } |
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index 762ea79..f72b36c 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | |||
@@ -109,7 +109,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
109 | Hashtable requestData = (Hashtable)request.Params[0]; | 109 | Hashtable requestData = (Hashtable)request.Params[0]; |
110 | //string host = (string)requestData["host"]; | 110 | //string host = (string)requestData["host"]; |
111 | //string portstr = (string)requestData["port"]; | 111 | //string portstr = (string)requestData["port"]; |
112 | string regionID_str = (string)requestData["regionID"]; | 112 | string regionID_str = (string)requestData["region_uuid"]; |
113 | UUID regionID = UUID.Zero; | 113 | UUID regionID = UUID.Zero; |
114 | UUID.TryParse(regionID_str, out regionID); | 114 | UUID.TryParse(regionID_str, out regionID); |
115 | 115 | ||
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 45e88ce..0c098d9 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -59,13 +59,13 @@ namespace OpenSim.Server.Handlers.Simulation | |||
59 | 59 | ||
60 | public Hashtable Handler(Hashtable request) | 60 | public Hashtable Handler(Hashtable request) |
61 | { | 61 | { |
62 | //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); | 62 | m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); |
63 | 63 | ||
64 | //m_log.Debug("---------------------------"); | 64 | m_log.Debug("---------------------------"); |
65 | //m_log.Debug(" >> uri=" + request["uri"]); | 65 | m_log.Debug(" >> uri=" + request["uri"]); |
66 | //m_log.Debug(" >> content-type=" + request["content-type"]); | 66 | m_log.Debug(" >> content-type=" + request["content-type"]); |
67 | //m_log.Debug(" >> http-method=" + request["http-method"]); | 67 | m_log.Debug(" >> http-method=" + request["http-method"]); |
68 | //m_log.Debug("---------------------------\n"); | 68 | m_log.Debug("---------------------------\n"); |
69 | 69 | ||
70 | Hashtable responsedata = new Hashtable(); | 70 | Hashtable responsedata = new Hashtable(); |
71 | responsedata["content_type"] = "text/html"; | 71 | responsedata["content_type"] = "text/html"; |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs index 0bb1c0e..953c7bd 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs | |||
@@ -50,6 +50,8 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
50 | 50 | ||
51 | private IAssetService m_AssetService; | 51 | private IAssetService m_AssetService; |
52 | 52 | ||
53 | public HypergridServiceConnector() : this(null) { } | ||
54 | |||
53 | public HypergridServiceConnector(IAssetService assService) | 55 | public HypergridServiceConnector(IAssetService assService) |
54 | { | 56 | { |
55 | m_AssetService = assService; | 57 | m_AssetService = assService; |
@@ -197,21 +199,24 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
197 | GridRegion region = new GridRegion(); | 199 | GridRegion region = new GridRegion(); |
198 | 200 | ||
199 | UUID.TryParse((string)hash["uuid"], out region.RegionID); | 201 | UUID.TryParse((string)hash["uuid"], out region.RegionID); |
200 | //m_log.Debug(">> HERE, uuid: " + uuid); | 202 | //m_log.Debug(">> HERE, uuid: " + region.RegionID); |
201 | int n = 0; | 203 | int n = 0; |
202 | if (hash["x"] != null) | 204 | if (hash["x"] != null) |
203 | { | 205 | { |
204 | Int32.TryParse((string)hash["x"], out n); | 206 | Int32.TryParse((string)hash["x"], out n); |
205 | region.RegionLocX = n; | 207 | region.RegionLocX = n; |
208 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
206 | } | 209 | } |
207 | if (hash["y"] != null) | 210 | if (hash["y"] != null) |
208 | { | 211 | { |
209 | Int32.TryParse((string)hash["y"], out n); | 212 | Int32.TryParse((string)hash["y"], out n); |
210 | region.RegionLocY = n; | 213 | region.RegionLocY = n; |
214 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | ||
211 | } | 215 | } |
212 | if (hash["region_name"] != null) | 216 | if (hash["region_name"] != null) |
213 | { | 217 | { |
214 | region.RegionName = (string)hash["region_name"]; | 218 | region.RegionName = (string)hash["region_name"]; |
219 | //m_log.Debug(">> HERE, name: " + region.RegionName); | ||
215 | } | 220 | } |
216 | if (hash["hostname"] != null) | 221 | if (hash["hostname"] != null) |
217 | region.ExternalHostName = (string)hash["hostname"]; | 222 | region.ExternalHostName = (string)hash["hostname"]; |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index ec7ef1d..a5bd881 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -112,6 +112,10 @@ namespace OpenSim.Services.HypergridService | |||
112 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", regionName); | 112 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", regionName); |
113 | if (!m_AllowTeleportsToAnyRegion) | 113 | if (!m_AllowTeleportsToAnyRegion) |
114 | { | 114 | { |
115 | List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); | ||
116 | if (defs != null && defs.Count > 0) | ||
117 | m_DefaultGatewayRegion = defs[0]; | ||
118 | |||
115 | try | 119 | try |
116 | { | 120 | { |
117 | regionID = m_DefaultGatewayRegion.RegionID; | 121 | regionID = m_DefaultGatewayRegion.RegionID; |
@@ -150,6 +154,8 @@ namespace OpenSim.Services.HypergridService | |||
150 | 154 | ||
151 | public GridRegion GetHyperlinkRegion(UUID regionID) | 155 | public GridRegion GetHyperlinkRegion(UUID regionID) |
152 | { | 156 | { |
157 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to get hyperlink region {0}", regionID); | ||
158 | |||
153 | if (!m_AllowTeleportsToAnyRegion) | 159 | if (!m_AllowTeleportsToAnyRegion) |
154 | // Don't even check the given regionID | 160 | // Don't even check the given regionID |
155 | return m_DefaultGatewayRegion; | 161 | return m_DefaultGatewayRegion; |
@@ -160,23 +166,43 @@ namespace OpenSim.Services.HypergridService | |||
160 | 166 | ||
161 | public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination) | 167 | public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination) |
162 | { | 168 | { |
169 | string authURL = string.Empty; | ||
170 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | ||
171 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
172 | |||
173 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}", | ||
174 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName); | ||
175 | |||
163 | if (!Authenticate(aCircuit)) | 176 | if (!Authenticate(aCircuit)) |
177 | { | ||
178 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Unable to verify identity of agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname); | ||
164 | return false; | 179 | return false; |
180 | } | ||
165 | 181 | ||
166 | // Check to see if we have a local user with that UUID | 182 | // Check to see if we have a local user with that UUID |
167 | UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); | 183 | UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); |
168 | if (account != null) | 184 | if (account != null) |
185 | { | ||
169 | // No, sorry; go away | 186 | // No, sorry; go away |
187 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.", | ||
188 | aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID); | ||
170 | return false; | 189 | return false; |
190 | } | ||
171 | 191 | ||
172 | // May want to authorize | 192 | // May want to authorize |
173 | 193 | ||
174 | // Login the presence | 194 | // Login the presence |
175 | if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) | 195 | if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) |
196 | { | ||
197 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.", | ||
198 | aCircuit.firstname, aCircuit.lastname); | ||
176 | return false; | 199 | return false; |
200 | } | ||
177 | 201 | ||
178 | // Finally launch the agent at the destination | 202 | // Finally launch the agent at the destination |
179 | string reason = string.Empty; | 203 | string reason = string.Empty; |
204 | aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; | ||
205 | aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
180 | return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); | 206 | return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); |
181 | } | 207 | } |
182 | 208 | ||
@@ -188,9 +214,15 @@ namespace OpenSim.Services.HypergridService | |||
188 | 214 | ||
189 | protected bool Authenticate(AgentCircuitData aCircuit) | 215 | protected bool Authenticate(AgentCircuitData aCircuit) |
190 | { | 216 | { |
191 | string authURL = string.Empty; // GetAuthURL(aCircuit); | 217 | string authURL = string.Empty; |
218 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | ||
219 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
220 | |||
192 | if (authURL == string.Empty) | 221 | if (authURL == string.Empty) |
222 | { | ||
223 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide an authentication server URL"); | ||
193 | return false; | 224 | return false; |
225 | } | ||
194 | 226 | ||
195 | Object[] args = new Object[] { authURL }; | 227 | Object[] args = new Object[] { authURL }; |
196 | IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args); | 228 | IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args); |
diff --git a/OpenSim/Services/HypergridService/HypergridService.cs b/OpenSim/Services/HypergridService/HypergridService.cs index 747b98a..734931d 100644 --- a/OpenSim/Services/HypergridService/HypergridService.cs +++ b/OpenSim/Services/HypergridService/HypergridService.cs | |||
@@ -347,10 +347,12 @@ namespace OpenSim.Services.HypergridService | |||
347 | 347 | ||
348 | #region Get Hyperlinks | 348 | #region Get Hyperlinks |
349 | 349 | ||
350 | public GridRegion GetHyperlinkRegion(UUID regionID) | 350 | public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) |
351 | { | 351 | { |
352 | //GridRegion region = m_HypergridConnector. | 352 | if (m_HyperlinkRegions.ContainsKey(regionID)) |
353 | return null; | 353 | return m_HypergridConnector.GetHyperlinkRegion(gatekeeper, regionID); |
354 | else | ||
355 | return gatekeeper; | ||
354 | } | 356 | } |
355 | 357 | ||
356 | #endregion | 358 | #endregion |
diff --git a/OpenSim/Services/Interfaces/IHypergridService.cs b/OpenSim/Services/Interfaces/IHypergridService.cs index b49657a..f2a1983 100644 --- a/OpenSim/Services/Interfaces/IHypergridService.cs +++ b/OpenSim/Services/Interfaces/IHypergridService.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Services.Interfaces | |||
36 | public interface IHypergridService | 36 | public interface IHypergridService |
37 | { | 37 | { |
38 | bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason); | 38 | bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason); |
39 | GridRegion GetHyperlinkRegion(UUID regionID); | 39 | GridRegion GetHyperlinkRegion(GridRegion gateway, UUID regionID); |
40 | 40 | ||
41 | GridRegion GetRegionByUUID(UUID regionID); | 41 | GridRegion GetRegionByUUID(UUID regionID); |
42 | GridRegion GetRegionByPosition(int x, int y); | 42 | GridRegion GetRegionByPosition(int x, int y); |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 6f92388..d4f89d9 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -37,24 +37,26 @@ namespace OpenSim.Services.LLLoginService | |||
37 | private bool m_RequireInventory; | 37 | private bool m_RequireInventory; |
38 | private int m_MinLoginLevel; | 38 | private int m_MinLoginLevel; |
39 | 39 | ||
40 | IConfig m_LoginServerConfig; | ||
41 | |||
40 | public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) | 42 | public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) |
41 | { | 43 | { |
42 | IConfig serverConfig = config.Configs["LoginService"]; | 44 | m_LoginServerConfig = config.Configs["LoginService"]; |
43 | if (serverConfig == null) | 45 | if (m_LoginServerConfig == null) |
44 | throw new Exception(String.Format("No section LoginService in config file")); | 46 | throw new Exception(String.Format("No section LoginService in config file")); |
45 | 47 | ||
46 | string accountService = serverConfig.GetString("UserAccountService", String.Empty); | 48 | string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty); |
47 | string authService = serverConfig.GetString("AuthenticationService", String.Empty); | 49 | string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty); |
48 | string invService = serverConfig.GetString("InventoryService", String.Empty); | 50 | string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty); |
49 | string gridService = serverConfig.GetString("GridService", String.Empty); | 51 | string gridService = m_LoginServerConfig.GetString("GridService", String.Empty); |
50 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); | 52 | string presenceService = m_LoginServerConfig.GetString("PresenceService", String.Empty); |
51 | string libService = serverConfig.GetString("LibraryService", String.Empty); | 53 | string libService = m_LoginServerConfig.GetString("LibraryService", String.Empty); |
52 | string avatarService = serverConfig.GetString("AvatarService", String.Empty); | 54 | string avatarService = m_LoginServerConfig.GetString("AvatarService", String.Empty); |
53 | string simulationService = serverConfig.GetString("SimulationService", String.Empty); | 55 | string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty); |
54 | 56 | ||
55 | m_DefaultRegionName = serverConfig.GetString("DefaultRegion", String.Empty); | 57 | m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty); |
56 | m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); | 58 | m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); |
57 | m_RequireInventory = serverConfig.GetBoolean("RequireInventory", true); | 59 | m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true); |
58 | 60 | ||
59 | // These are required; the others aren't | 61 | // These are required; the others aren't |
60 | if (accountService == string.Empty || authService == string.Empty) | 62 | if (accountService == string.Empty || authService == string.Empty) |
@@ -438,7 +440,7 @@ namespace OpenSim.Services.LLLoginService | |||
438 | aCircuit.SecureSessionID = secureSession; | 440 | aCircuit.SecureSessionID = secureSession; |
439 | aCircuit.SessionID = session; | 441 | aCircuit.SessionID = session; |
440 | aCircuit.startpos = position; | 442 | aCircuit.startpos = position; |
441 | aCircuit.ServiceURLs = account.ServiceURLs; | 443 | SetServiceURLs(aCircuit, account); |
442 | 444 | ||
443 | if (simConnector.CreateAgent(region, aCircuit, 0, out reason)) | 445 | if (simConnector.CreateAgent(region, aCircuit, 0, out reason)) |
444 | return aCircuit; | 446 | return aCircuit; |
@@ -447,6 +449,25 @@ namespace OpenSim.Services.LLLoginService | |||
447 | 449 | ||
448 | } | 450 | } |
449 | 451 | ||
452 | private void SetServiceURLs(AgentCircuitData aCircuit, UserAccount account) | ||
453 | { | ||
454 | aCircuit.ServiceURLs = new Dictionary<string, object>(); | ||
455 | if (account.ServiceURLs == null) | ||
456 | return; | ||
457 | |||
458 | foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) | ||
459 | { | ||
460 | if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty)) | ||
461 | { | ||
462 | aCircuit.ServiceURLs[kvp.Key] = m_LoginServerConfig.GetString(kvp.Key, string.Empty); | ||
463 | } | ||
464 | else | ||
465 | { | ||
466 | aCircuit.ServiceURLs[kvp.Key] = kvp.Value; | ||
467 | } | ||
468 | } | ||
469 | } | ||
470 | |||
450 | #region Console Commands | 471 | #region Console Commands |
451 | private void RegisterCommands() | 472 | private void RegisterCommands() |
452 | { | 473 | { |