diff options
author | Brian McBee | 2008-01-20 21:11:55 +0000 |
---|---|---|
committer | Brian McBee | 2008-01-20 21:11:55 +0000 |
commit | 59d7165f40d01b0df5d28a2654da844a9abcd2db (patch) | |
tree | 558cb8af489512b18280559e8ab9fc9bcdfd4863 /OpenSim | |
parent | Check if remote simulator is up before attempting teleport. Teleport to a rem... (diff) | |
download | opensim-SC-59d7165f40d01b0df5d28a2654da844a9abcd2db.zip opensim-SC-59d7165f40d01b0df5d28a2654da844a9abcd2db.tar.gz opensim-SC-59d7165f40d01b0df5d28a2654da844a9abcd2db.tar.bz2 opensim-SC-59d7165f40d01b0df5d28a2654da844a9abcd2db.tar.xz |
Graceful failure of teleport to unavailable regions might actually work now.
I blame all bugs on the age of my brain cells.
Diffstat (limited to 'OpenSim')
4 files changed, 34 insertions, 10 deletions
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index e2a96f6..13ae21f 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs | |||
@@ -32,6 +32,8 @@ namespace OpenSim.Framework.Communications | |||
32 | public interface IInterRegionCommunications | 32 | public interface IInterRegionCommunications |
33 | { | 33 | { |
34 | string rdebugRegionName { get; set; } | 34 | string rdebugRegionName { get; set; } |
35 | bool Available { get; } | ||
36 | void CheckRegion(string address, uint port); | ||
35 | bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); | 37 | bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); |
36 | bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); | 38 | bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); |
37 | bool RegionUp(SearializableRegionInfo region, ulong regionhandle); | 39 | bool RegionUp(SearializableRegionInfo region, ulong regionhandle); |
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 8cba6fd..5b16e5a 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -47,6 +47,18 @@ namespace OpenSim.Region.Communications.Local | |||
47 | 47 | ||
48 | public string _gdebugRegionName = System.String.Empty; | 48 | public string _gdebugRegionName = System.String.Empty; |
49 | 49 | ||
50 | bool m_bAvailable=true; | ||
51 | |||
52 | public void CheckRegion(string address, uint port) | ||
53 | { | ||
54 | m_bAvailable = true; | ||
55 | } | ||
56 | |||
57 | public bool Available | ||
58 | { | ||
59 | get { return m_bAvailable; } | ||
60 | } | ||
61 | |||
50 | public string gdebugRegionName | 62 | public string gdebugRegionName |
51 | { | 63 | { |
52 | get { return _gdebugRegionName; } | 64 | get { return _gdebugRegionName; } |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 78dca09..7cd77db 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -594,9 +594,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
594 | //don't want to be creating a new link to the remote instance every time like we are here | 594 | //don't want to be creating a new link to the remote instance every time like we are here |
595 | bool retValue = false; | 595 | bool retValue = false; |
596 | 596 | ||
597 | checkRegion(regInfo.RemotingAddress, regInfo.RemotingPort); | 597 | |
598 | if (Available) | ||
599 | { | ||
600 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 598 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
601 | typeof(OGS1InterRegionRemoting), | 599 | typeof(OGS1InterRegionRemoting), |
602 | "tcp://" + regInfo.RemotingAddress + | 600 | "tcp://" + regInfo.RemotingAddress + |
@@ -618,7 +616,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
618 | retValue.ToString()); | 616 | retValue.ToString()); |
619 | 617 | ||
620 | return retValue; | 618 | return retValue; |
621 | } | 619 | |
622 | } | 620 | } |
623 | 621 | ||
624 | return false; | 622 | return false; |
@@ -1091,18 +1089,18 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1091 | 1089 | ||
1092 | // helper to see if remote region is up | 1090 | // helper to see if remote region is up |
1093 | bool m_bAvailable = false; | 1091 | bool m_bAvailable = false; |
1094 | int timeOut = 15000; //15 seconds | 1092 | int timeOut = 10; //10 seconds |
1095 | 1093 | ||
1096 | public void checkRegion(string address, uint port) | 1094 | public void CheckRegion(string address, uint port) |
1097 | { | 1095 | { |
1096 | m_bAvailable = false; | ||
1098 | IPAddress ia = null; | 1097 | IPAddress ia = null; |
1099 | IPAddress.TryParse(address, out ia); | 1098 | IPAddress.TryParse(address, out ia); |
1100 | IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port); | 1099 | IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port); |
1101 | AsyncCallback ConnectedMethodCallback = new AsyncCallback(ConnectedMethod); | 1100 | AsyncCallback ConnectedMethodCallback = new AsyncCallback(ConnectedMethod); |
1102 | Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); | 1101 | Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); |
1103 | IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket); | 1102 | IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket); |
1104 | ar.AsyncWaitHandle.WaitOne(timeOut, false); | 1103 | ar.AsyncWaitHandle.WaitOne(timeOut*1000, false); |
1105 | socket.Close(); | ||
1106 | } | 1104 | } |
1107 | 1105 | ||
1108 | public bool Available | 1106 | public bool Available |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 640cb3b..666edb1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -403,6 +403,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
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 | bool destRegionUp = false; | ||
406 | if (regionHandle == m_regionInfo.RegionHandle) | 407 | if (regionHandle == m_regionInfo.RegionHandle) |
407 | { | 408 | { |
408 | avatar.ControllingClient.SendTeleportLocationStart(); | 409 | avatar.ControllingClient.SendTeleportLocationStart(); |
@@ -421,10 +422,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
421 | agent.startpos = position; | 422 | agent.startpos = position; |
422 | agent.child = true; | 423 | agent.child = true; |
423 | 424 | ||
424 | 425 | if (reg.RemotingAddress != "" && reg.RemotingPort != 0) | |
425 | if(m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent)) | 426 | { |
427 | // region is remote. see if it is up | ||
428 | m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort); | ||
429 | destRegionUp = m_commsProvider.InterRegion.Available; | ||
430 | } | ||
431 | else | ||
432 | { | ||
433 | // assume local regions are always up | ||
434 | destRegionUp = true; | ||
435 | } | ||
436 | if(destRegionUp) | ||
426 | { | 437 | { |
427 | avatar.Close(); | 438 | avatar.Close(); |
439 | m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent); | ||
428 | m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, | 440 | m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, |
429 | position, false); | 441 | position, false); |
430 | AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); | 442 | AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); |