diff options
author | lbsa71 | 2007-12-27 21:41:48 +0000 |
---|---|---|
committer | lbsa71 | 2007-12-27 21:41:48 +0000 |
commit | efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch) | |
tree | bf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |
parent | * removed always true if (diff) | |
download | opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2 opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz |
* Optimized usings
* shortened references
* Removed redundant 'this'
* Normalized EOF
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index b184af2..3942397 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -1,4 +1,4 @@ | |||
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 | * |
@@ -29,11 +29,10 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Text; | ||
33 | using libsecondlife; | 32 | using libsecondlife; |
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Console; | ||
37 | 36 | ||
38 | namespace OpenSim.Region.Environment.Scenes | 37 | namespace OpenSim.Region.Environment.Scenes |
39 | { | 38 | { |
@@ -52,7 +51,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
52 | public event PrimCrossing OnPrimCrossingIntoRegion; | 51 | public event PrimCrossing OnPrimCrossingIntoRegion; |
53 | public event RegionUp OnRegionUp; | 52 | public event RegionUp OnRegionUp; |
54 | public event ChildAgentUpdate OnChildAgentUpdate; | 53 | public event ChildAgentUpdate OnChildAgentUpdate; |
55 | 54 | ||
56 | 55 | ||
57 | public KillObjectDelegate KillObject; | 56 | public KillObjectDelegate KillObject; |
58 | public string _debugRegionName = ""; | 57 | public string _debugRegionName = ""; |
@@ -60,10 +59,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
60 | public string debugRegionName | 59 | public string debugRegionName |
61 | { | 60 | { |
62 | get { return _debugRegionName; } | 61 | get { return _debugRegionName; } |
63 | set | 62 | set { _debugRegionName = value; } |
64 | { | ||
65 | _debugRegionName = value; | ||
66 | } | ||
67 | } | 63 | } |
68 | 64 | ||
69 | public SceneCommunicationService(CommunicationsManager commsMan) | 65 | public SceneCommunicationService(CommunicationsManager commsMan) |
@@ -90,7 +86,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
90 | regionCommsHost.OnCloseAgentConnection += CloseConnection; | 86 | regionCommsHost.OnCloseAgentConnection += CloseConnection; |
91 | regionCommsHost.OnRegionUp += newRegionUp; | 87 | regionCommsHost.OnRegionUp += newRegionUp; |
92 | regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; | 88 | regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; |
93 | |||
94 | } | 89 | } |
95 | else | 90 | else |
96 | { | 91 | { |
@@ -102,7 +97,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
102 | { | 97 | { |
103 | if (regionCommsHost != null) | 98 | if (regionCommsHost != null) |
104 | { | 99 | { |
105 | |||
106 | regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; | 100 | regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; |
107 | regionCommsHost.OnRegionUp -= newRegionUp; | 101 | regionCommsHost.OnRegionUp -= newRegionUp; |
108 | regionCommsHost.OnExpectUser -= NewUserConnection; | 102 | regionCommsHost.OnExpectUser -= NewUserConnection; |
@@ -115,6 +109,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
115 | } | 109 | } |
116 | 110 | ||
117 | #region CommsManager Event handlers | 111 | #region CommsManager Event handlers |
112 | |||
118 | /// <summary> | 113 | /// <summary> |
119 | /// | 114 | /// |
120 | /// </summary> | 115 | /// </summary> |
@@ -139,6 +134,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
139 | } | 134 | } |
140 | return true; | 135 | return true; |
141 | } | 136 | } |
137 | |||
142 | protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 138 | protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) |
143 | { | 139 | { |
144 | if (OnChildAgentUpdate != null) | 140 | if (OnChildAgentUpdate != null) |
@@ -155,6 +151,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
155 | OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); | 151 | OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); |
156 | } | 152 | } |
157 | } | 153 | } |
154 | |||
158 | protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) | 155 | protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) |
159 | { | 156 | { |
160 | if (OnPrimCrossingIntoRegion != null) | 157 | if (OnPrimCrossingIntoRegion != null) |
@@ -174,12 +171,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
174 | #endregion | 171 | #endregion |
175 | 172 | ||
176 | #region Inform Client of Neighbours | 173 | #region Inform Client of Neighbours |
174 | |||
177 | private delegate void InformClientOfNeighbourDelegate( | 175 | private delegate void InformClientOfNeighbourDelegate( |
178 | ScenePresence avatar, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint); | 176 | ScenePresence avatar, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint); |
179 | 177 | ||
180 | private void InformClientOfNeighbourCompleted(IAsyncResult iar) | 178 | private void InformClientOfNeighbourCompleted(IAsyncResult iar) |
181 | { | 179 | { |
182 | InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState; | 180 | InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState; |
183 | icon.EndInvoke(iar); | 181 | icon.EndInvoke(iar); |
184 | } | 182 | } |
185 | 183 | ||
@@ -215,8 +213,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
215 | 213 | ||
216 | //blah.Address = region.RemotingAddress; | 214 | //blah.Address = region.RemotingAddress; |
217 | //blah.Port = region.RemotingPort; | 215 | //blah.Port = region.RemotingPort; |
218 | |||
219 | |||
220 | } | 216 | } |
221 | 217 | ||
222 | /// <summary> | 218 | /// <summary> |
@@ -227,7 +223,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
227 | { | 223 | { |
228 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); | 224 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); |
229 | 225 | ||
230 | //m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 226 | //m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
231 | for (int i = 0; i < lstneighbours.Count; i++) | 227 | for (int i = 0; i < lstneighbours.Count; i++) |
232 | { | 228 | { |
233 | // We don't want to keep sending to regions that consistently fail on comms. | 229 | // We don't want to keep sending to regions that consistently fail on comms. |
@@ -245,7 +241,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
245 | { | 241 | { |
246 | for (int i = 0; i < neighbours.Count; i++) | 242 | for (int i = 0; i < neighbours.Count; i++) |
247 | { | 243 | { |
248 | |||
249 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); | 244 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); |
250 | agent.BaseFolder = LLUUID.Zero; | 245 | agent.BaseFolder = LLUUID.Zero; |
251 | agent.InventoryFolder = LLUUID.Zero; | 246 | agent.InventoryFolder = LLUUID.Zero; |
@@ -259,6 +254,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
259 | } | 254 | } |
260 | } | 255 | } |
261 | } | 256 | } |
257 | |||
262 | /// <summary> | 258 | /// <summary> |
263 | /// This informs a single neighboring region about agent "avatar". | 259 | /// This informs a single neighboring region about agent "avatar". |
264 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 260 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
@@ -278,11 +274,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
278 | } | 274 | } |
279 | 275 | ||
280 | #endregion | 276 | #endregion |
277 | |||
281 | public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle); | 278 | public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle); |
282 | 279 | ||
283 | private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar) | 280 | private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar) |
284 | { | 281 | { |
285 | InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate)iar.AsyncState; | 282 | InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate) iar.AsyncState; |
286 | icon.EndInvoke(iar); | 283 | icon.EndInvoke(iar); |
287 | } | 284 | } |
288 | 285 | ||
@@ -290,7 +287,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
290 | private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle) | 287 | private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle) |
291 | { | 288 | { |
292 | MainLog.Instance.Notice("INTERGRID", "Starting to inform neighbors that I'm here"); | 289 | MainLog.Instance.Notice("INTERGRID", "Starting to inform neighbors that I'm here"); |
293 | bool regionAccepted = m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle); | 290 | bool regionAccepted = |
291 | m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle); | ||
294 | 292 | ||
295 | if (regionAccepted) | 293 | if (regionAccepted) |
296 | { | 294 | { |
@@ -301,6 +299,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
301 | MainLog.Instance.Notice("INTERGRID", "Failed to inform neighbors that I'm here"); | 299 | MainLog.Instance.Notice("INTERGRID", "Failed to inform neighbors that I'm here"); |
302 | } | 300 | } |
303 | } | 301 | } |
302 | |||
304 | /// <summary> | 303 | /// <summary> |
305 | /// Called by scene when region is initialized (not always when it's listening for agents) | 304 | /// Called by scene when region is initialized (not always when it's listening for agents) |
306 | /// This is an inter-region message that informs the surrounding neighbors that the sim is up. | 305 | /// This is an inter-region message that informs the surrounding neighbors that the sim is up. |
@@ -317,7 +316,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
317 | { | 316 | { |
318 | for (int i = 0; i < neighbours.Count; i++) | 317 | for (int i = 0; i < neighbours.Count; i++) |
319 | { | 318 | { |
320 | |||
321 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; | 319 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; |
322 | 320 | ||
323 | d.BeginInvoke(region, neighbours[i].RegionHandle, | 321 | d.BeginInvoke(region, neighbours[i].RegionHandle, |
@@ -325,9 +323,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
325 | d); | 323 | d); |
326 | } | 324 | } |
327 | } | 325 | } |
328 | 326 | ||
329 | //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); | 327 | //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); |
330 | } | 328 | } |
329 | |||
331 | public delegate void SendChildAgentDataUpdateDelegate(ulong regionHandle, ChildAgentDataUpdate cAgentData); | 330 | public delegate void SendChildAgentDataUpdateDelegate(ulong regionHandle, ChildAgentDataUpdate cAgentData); |
332 | 331 | ||
333 | /// <summary> | 332 | /// <summary> |
@@ -340,7 +339,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
340 | private void SendChildAgentDataUpdateAsync(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 339 | private void SendChildAgentDataUpdateAsync(ulong regionHandle, ChildAgentDataUpdate cAgentData) |
341 | { | 340 | { |
342 | MainLog.Instance.Notice("INTERGRID", "Informing a neighbor about my agent."); | 341 | MainLog.Instance.Notice("INTERGRID", "Informing a neighbor about my agent."); |
343 | bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle,cAgentData); | 342 | bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); |
344 | 343 | ||
345 | if (regionAccepted) | 344 | if (regionAccepted) |
346 | { | 345 | { |
@@ -351,11 +350,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
351 | MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent"); | 350 | MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent"); |
352 | } | 351 | } |
353 | } | 352 | } |
353 | |||
354 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) | 354 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) |
355 | { | 355 | { |
356 | SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate)iar.AsyncState; | 356 | SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate) iar.AsyncState; |
357 | icon.EndInvoke(iar); | 357 | icon.EndInvoke(iar); |
358 | } | 358 | } |
359 | |||
359 | public void SendChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 360 | public void SendChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) |
360 | { | 361 | { |
361 | // This assumes that we know what our neighbors are. | 362 | // This assumes that we know what our neighbors are. |
@@ -363,9 +364,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
363 | d.BeginInvoke(regionHandle, cAgentData, | 364 | d.BeginInvoke(regionHandle, cAgentData, |
364 | SendChildAgentDataUpdateCompleted, | 365 | SendChildAgentDataUpdateCompleted, |
365 | d); | 366 | d); |
366 | |||
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | /// <summary> | 370 | /// <summary> |
371 | /// Helper function to request neighbors from grid-comms | 371 | /// Helper function to request neighbors from grid-comms |
@@ -401,15 +401,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
401 | /// <param name="lookAt"></param> | 401 | /// <param name="lookAt"></param> |
402 | /// <param name="flags"></param> | 402 | /// <param name="flags"></param> |
403 | public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position, | 403 | public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position, |
404 | LLVector3 lookAt, uint flags) | 404 | LLVector3 lookAt, uint flags) |
405 | { | 405 | { |
406 | if (regionHandle == m_regionInfo.RegionHandle) | 406 | if (regionHandle == m_regionInfo.RegionHandle) |
407 | { | 407 | { |
408 | |||
409 | avatar.ControllingClient.SendTeleportLocationStart(); | 408 | avatar.ControllingClient.SendTeleportLocationStart(); |
410 | avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags); | 409 | avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags); |
411 | avatar.Teleport(position); | 410 | avatar.Teleport(position); |
412 | |||
413 | } | 411 | } |
414 | else | 412 | else |
415 | { | 413 | { |
@@ -424,20 +422,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
424 | agent.child = true; | 422 | agent.child = true; |
425 | avatar.Close(); | 423 | avatar.Close(); |
426 | m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent); | 424 | m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent); |
427 | m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, position, false); | 425 | m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, |
426 | position, false); | ||
428 | AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); | 427 | AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); |
429 | string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId); | 428 | string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId); |
430 | avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath); | 429 | avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), |
430 | capsPath); | ||
431 | avatar.MakeChildAgent(); | 431 | avatar.MakeChildAgent(); |
432 | if (KillObject != null) | 432 | if (KillObject != null) |
433 | { | 433 | { |
434 | KillObject(avatar.LocalId); | 434 | KillObject(avatar.LocalId); |
435 | } | 435 | } |
436 | uint newRegionX = (uint)(regionHandle >> 40); | 436 | uint newRegionX = (uint) (regionHandle >> 40); |
437 | uint newRegionY = (((uint)(regionHandle)) >> 8); | 437 | uint newRegionY = (((uint) (regionHandle)) >> 8); |
438 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); | 438 | uint oldRegionX = (uint) (m_regionInfo.RegionHandle >> 40); |
439 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); | 439 | uint oldRegionY = (((uint) (m_regionInfo.RegionHandle)) >> 8); |
440 | if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) | 440 | if (Util.fast_distance2d((int) (newRegionX - oldRegionX), (int) (newRegionY - oldRegionY)) > 3) |
441 | { | 441 | { |
442 | CloseChildAgentConnections(avatar); | 442 | CloseChildAgentConnections(avatar); |
443 | } | 443 | } |
@@ -465,7 +465,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
465 | { | 465 | { |
466 | foreach (ulong regionHandle in presence.KnownChildRegions) | 466 | foreach (ulong regionHandle in presence.KnownChildRegions) |
467 | { | 467 | { |
468 | m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId); | 468 | m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, |
469 | presence.ControllingClient.AgentId); | ||
469 | presence.RemoveNeighbourRegion(regionHandle); | 470 | presence.RemoveNeighbourRegion(regionHandle); |
470 | } | 471 | } |
471 | } | 472 | } |
@@ -474,6 +475,5 @@ namespace OpenSim.Region.Environment.Scenes | |||
474 | { | 475 | { |
475 | return m_commsProvider.GridService.GetGridSettings(); | 476 | return m_commsProvider.GridService.GetGridSettings(); |
476 | } | 477 | } |
477 | |||
478 | } | 478 | } |
479 | } | 479 | } \ No newline at end of file |