Check if remote simulator is up before attempting teleport. Teleport to a remote region should now fail gracefully if remote simulator is down.
parent
8ffefd2bd6
commit
730e2d6d7c
|
@ -555,7 +555,7 @@ namespace OpenSim.Framework
|
||||||
void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID,
|
void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID,
|
||||||
uint flags, string capsURL);
|
uint flags, string capsURL);
|
||||||
|
|
||||||
void SendTeleportFailed();
|
void SendTeleportFailed(string reason);
|
||||||
void SendTeleportLocationStart();
|
void SendTeleportLocationStart();
|
||||||
void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
|
void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
|
||||||
|
|
||||||
|
|
|
@ -890,11 +890,11 @@ namespace OpenSim.Region.ClientStack
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendTeleportFailed()
|
public void SendTeleportFailed(string reason)
|
||||||
{
|
{
|
||||||
TeleportFailedPacket tpFailed = (TeleportFailedPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFailed);
|
TeleportFailedPacket tpFailed = (TeleportFailedPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFailed);
|
||||||
tpFailed.Info.AgentID = AgentId;
|
tpFailed.Info.AgentID = AgentId;
|
||||||
tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport");
|
tpFailed.Info.Reason = Helpers.StringToField(reason);
|
||||||
OutPacket(tpFailed, ThrottleOutPacketType.Task);
|
OutPacket(tpFailed, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -594,28 +594,31 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
//don't want to be creating a new link to the remote instance every time like we are here
|
//don't want to be creating a new link to the remote instance every time like we are here
|
||||||
bool retValue = false;
|
bool retValue = false;
|
||||||
|
|
||||||
|
checkRegion(regInfo.RemotingAddress, regInfo.RemotingPort);
|
||||||
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
|
if (Available)
|
||||||
typeof (OGS1InterRegionRemoting),
|
|
||||||
"tcp://" + regInfo.RemotingAddress +
|
|
||||||
":" + regInfo.RemotingPort +
|
|
||||||
"/InterRegions");
|
|
||||||
|
|
||||||
if (remObject != null)
|
|
||||||
{
|
{
|
||||||
retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData));
|
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
|
||||||
}
|
typeof(OGS1InterRegionRemoting),
|
||||||
else
|
"tcp://" + regInfo.RemotingAddress +
|
||||||
{
|
":" + regInfo.RemotingPort +
|
||||||
Console.WriteLine("remoting object not found");
|
"/InterRegions");
|
||||||
}
|
|
||||||
remObject = null;
|
|
||||||
MainLog.Instance.Verbose("INTER",
|
|
||||||
gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " +
|
|
||||||
agentData.firstname + " " + agentData.lastname + " and got " +
|
|
||||||
retValue.ToString());
|
|
||||||
|
|
||||||
return retValue;
|
if (remObject != null)
|
||||||
|
{
|
||||||
|
retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("remoting object not found");
|
||||||
|
}
|
||||||
|
remObject = null;
|
||||||
|
MainLog.Instance.Verbose("INTER",
|
||||||
|
gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " +
|
||||||
|
agentData.firstname + " " + agentData.lastname + " and got " +
|
||||||
|
retValue.ToString());
|
||||||
|
|
||||||
|
return retValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1085,5 +1088,41 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
// helper to see if remote region is up
|
||||||
|
bool m_bAvailable = false;
|
||||||
|
int timeOut = 15000; //15 seconds
|
||||||
|
|
||||||
|
public void checkRegion(string address, uint port)
|
||||||
|
{
|
||||||
|
IPAddress ia = null;
|
||||||
|
IPAddress.TryParse(address, out ia);
|
||||||
|
IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port);
|
||||||
|
AsyncCallback ConnectedMethodCallback = new AsyncCallback(ConnectedMethod);
|
||||||
|
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket);
|
||||||
|
ar.AsyncWaitHandle.WaitOne(timeOut, false);
|
||||||
|
socket.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Available
|
||||||
|
{
|
||||||
|
get { return m_bAvailable; }
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectedMethod(IAsyncResult ar)
|
||||||
|
{
|
||||||
|
Socket socket = (Socket)ar.AsyncState;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
socket.EndConnect(ar);
|
||||||
|
m_bAvailable = true;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
socket.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -420,11 +420,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
agent.InventoryFolder = LLUUID.Zero;
|
agent.InventoryFolder = LLUUID.Zero;
|
||||||
agent.startpos = position;
|
agent.startpos = position;
|
||||||
agent.child = true;
|
agent.child = true;
|
||||||
avatar.Close();
|
|
||||||
if (m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent) &&
|
|
||||||
m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
|
if(m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent))
|
||||||
position, false)) ;
|
|
||||||
{
|
{
|
||||||
|
avatar.Close();
|
||||||
|
m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
|
||||||
|
position, false);
|
||||||
AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
|
AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
|
||||||
string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId);
|
string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId);
|
||||||
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
|
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
|
||||||
|
@ -443,6 +445,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
CloseChildAgentConnections(avatar);
|
CloseChildAgentConnections(avatar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
avatar.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ namespace SimpleApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SendTeleportFailed()
|
public virtual void SendTeleportFailed(string reason)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue