aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorBrian McBee2008-01-20 19:12:00 +0000
committerBrian McBee2008-01-20 19:12:00 +0000
commit730e2d6d7c0e6ddc6448c4b6064498294134d67f (patch)
treed26706e6361599b8cadc49eac59ba281fe459755 /OpenSim
parentTedds temp fix for startup crash: Waiting 3 seconds for stuff to catch up. (S... (diff)
downloadopensim-SC_OLD-730e2d6d7c0e6ddc6448c4b6064498294134d67f.zip
opensim-SC_OLD-730e2d6d7c0e6ddc6448c4b6064498294134d67f.tar.gz
opensim-SC_OLD-730e2d6d7c0e6ddc6448c4b6064498294134d67f.tar.bz2
opensim-SC_OLD-730e2d6d7c0e6ddc6448c4b6064498294134d67f.tar.xz
Check if remote simulator is up before attempting teleport. Teleport to a remote region should now fail gracefully if remote simulator is down.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs4
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs77
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs14
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs2
5 files changed, 72 insertions, 27 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 046688f..a84443b 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -555,7 +555,7 @@ namespace OpenSim.Framework
555 void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, 555 void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID,
556 uint flags, string capsURL); 556 uint flags, string capsURL);
557 557
558 void SendTeleportFailed(); 558 void SendTeleportFailed(string reason);
559 void SendTeleportLocationStart(); 559 void SendTeleportLocationStart();
560 void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); 560 void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
561 561
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 414c81e..f37ffc9 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -890,11 +890,11 @@ namespace OpenSim.Region.ClientStack
890 /// <summary> 890 /// <summary>
891 /// 891 ///
892 /// </summary> 892 /// </summary>
893 public void SendTeleportFailed() 893 public void SendTeleportFailed(string reason)
894 { 894 {
895 TeleportFailedPacket tpFailed = (TeleportFailedPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFailed); 895 TeleportFailedPacket tpFailed = (TeleportFailedPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFailed);
896 tpFailed.Info.AgentID = AgentId; 896 tpFailed.Info.AgentID = AgentId;
897 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport"); 897 tpFailed.Info.Reason = Helpers.StringToField(reason);
898 OutPacket(tpFailed, ThrottleOutPacketType.Task); 898 OutPacket(tpFailed, ThrottleOutPacketType.Task);
899 } 899 }
900 900
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index e3d10b5..78dca09 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -594,28 +594,31 @@ 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);
598 if (Available)
599 {
600 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
601 typeof(OGS1InterRegionRemoting),
602 "tcp://" + regInfo.RemotingAddress +
603 ":" + regInfo.RemotingPort +
604 "/InterRegions");
597 605
598 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( 606 if (remObject != null)
599 typeof (OGS1InterRegionRemoting), 607 {
600 "tcp://" + regInfo.RemotingAddress + 608 retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData));
601 ":" + regInfo.RemotingPort + 609 }
602 "/InterRegions"); 610 else
611 {
612 Console.WriteLine("remoting object not found");
613 }
614 remObject = null;
615 MainLog.Instance.Verbose("INTER",
616 gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " +
617 agentData.firstname + " " + agentData.lastname + " and got " +
618 retValue.ToString());
603 619
604 if (remObject != null) 620 return retValue;
605 {
606 retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData));
607 }
608 else
609 {
610 Console.WriteLine("remoting object not found");
611 } 621 }
612 remObject = null;
613 MainLog.Instance.Verbose("INTER",
614 gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " +
615 agentData.firstname + " " + agentData.lastname + " and got " +
616 retValue.ToString());
617
618 return retValue;
619 } 622 }
620 623
621 return false; 624 return false;
@@ -1085,5 +1088,41 @@ namespace OpenSim.Region.Communications.OGS1
1085 #endregion 1088 #endregion
1086 1089
1087 #endregion 1090 #endregion
1091
1092 // helper to see if remote region is up
1093 bool m_bAvailable = false;
1094 int timeOut = 15000; //15 seconds
1095
1096 public void checkRegion(string address, uint port)
1097 {
1098 IPAddress ia = null;
1099 IPAddress.TryParse(address, out ia);
1100 IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port);
1101 AsyncCallback ConnectedMethodCallback = new AsyncCallback(ConnectedMethod);
1102 Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
1103 IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket);
1104 ar.AsyncWaitHandle.WaitOne(timeOut, false);
1105 socket.Close();
1106 }
1107
1108 public bool Available
1109 {
1110 get { return m_bAvailable; }
1111 }
1112
1113 void ConnectedMethod(IAsyncResult ar)
1114 {
1115 Socket socket = (Socket)ar.AsyncState;
1116 try
1117 {
1118 socket.EndConnect(ar);
1119 m_bAvailable = true;
1120 }
1121 catch (Exception)
1122 {
1123 }
1124 socket.Close();
1125 }
1088 } 1126 }
1127
1089} \ No newline at end of file 1128} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index ffe8327..640cb3b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -420,11 +420,13 @@ namespace OpenSim.Region.Environment.Scenes
420 agent.InventoryFolder = LLUUID.Zero; 420 agent.InventoryFolder = LLUUID.Zero;
421 agent.startpos = position; 421 agent.startpos = position;
422 agent.child = true; 422 agent.child = true;
423 avatar.Close(); 423
424 if (m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent) && 424
425 m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, 425 if(m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent))
426 position, false)) ;
427 { 426 {
427 avatar.Close();
428 m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
429 position, false);
428 AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); 430 AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
429 string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId); 431 string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId);
430 avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), 432 avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
@@ -443,6 +445,10 @@ namespace OpenSim.Region.Environment.Scenes
443 CloseChildAgentConnections(avatar); 445 CloseChildAgentConnections(avatar);
444 } 446 }
445 } 447 }
448 else
449 {
450 avatar.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
451 }
446 } 452 }
447 } 453 }
448 } 454 }
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index ecc2df4..69060f1 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -285,7 +285,7 @@ namespace SimpleApp
285 { 285 {
286 } 286 }
287 287
288 public virtual void SendTeleportFailed() 288 public virtual void SendTeleportFailed(string reason)
289 { 289 {
290 } 290 }
291 291