Graceful failure of teleport to unavailable regions might actually work now.

I blame all bugs on the age of my brain cells.
ThreadPoolClientBranch
Brian McBee 2008-01-20 21:11:55 +00:00
parent 730e2d6d7c
commit 59d7165f40
4 changed files with 34 additions and 10 deletions

View File

@ -32,6 +32,8 @@ namespace OpenSim.Framework.Communications
public interface IInterRegionCommunications public interface IInterRegionCommunications
{ {
string rdebugRegionName { get; set; } string rdebugRegionName { get; set; }
bool Available { get; }
void CheckRegion(string address, uint port);
bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData);
bool RegionUp(SearializableRegionInfo region, ulong regionhandle); bool RegionUp(SearializableRegionInfo region, ulong regionhandle);

View File

@ -47,6 +47,18 @@ namespace OpenSim.Region.Communications.Local
public string _gdebugRegionName = System.String.Empty; public string _gdebugRegionName = System.String.Empty;
bool m_bAvailable=true;
public void CheckRegion(string address, uint port)
{
m_bAvailable = true;
}
public bool Available
{
get { return m_bAvailable; }
}
public string gdebugRegionName public string gdebugRegionName
{ {
get { return _gdebugRegionName; } get { return _gdebugRegionName; }

View File

@ -594,9 +594,7 @@ 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);
if (Available)
{
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting), typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress + "tcp://" + regInfo.RemotingAddress +
@ -618,7 +616,7 @@ namespace OpenSim.Region.Communications.OGS1
retValue.ToString()); retValue.ToString());
return retValue; return retValue;
}
} }
return false; return false;
@ -1091,18 +1089,18 @@ namespace OpenSim.Region.Communications.OGS1
// helper to see if remote region is up // helper to see if remote region is up
bool m_bAvailable = false; bool m_bAvailable = false;
int timeOut = 15000; //15 seconds int timeOut = 10; //10 seconds
public void checkRegion(string address, uint port) public void CheckRegion(string address, uint port)
{ {
m_bAvailable = false;
IPAddress ia = null; IPAddress ia = null;
IPAddress.TryParse(address, out ia); IPAddress.TryParse(address, out ia);
IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port); IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port);
AsyncCallback ConnectedMethodCallback = new AsyncCallback(ConnectedMethod); AsyncCallback ConnectedMethodCallback = new AsyncCallback(ConnectedMethod);
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket); IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket);
ar.AsyncWaitHandle.WaitOne(timeOut, false); ar.AsyncWaitHandle.WaitOne(timeOut*1000, false);
socket.Close();
} }
public bool Available public bool Available

View File

@ -403,6 +403,7 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position, public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position,
LLVector3 lookAt, uint flags) LLVector3 lookAt, uint flags)
{ {
bool destRegionUp = false;
if (regionHandle == m_regionInfo.RegionHandle) if (regionHandle == m_regionInfo.RegionHandle)
{ {
avatar.ControllingClient.SendTeleportLocationStart(); avatar.ControllingClient.SendTeleportLocationStart();
@ -421,10 +422,21 @@ namespace OpenSim.Region.Environment.Scenes
agent.startpos = position; agent.startpos = position;
agent.child = true; agent.child = true;
if (reg.RemotingAddress != "" && reg.RemotingPort != 0)
if(m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent)) {
// region is remote. see if it is up
m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort);
destRegionUp = m_commsProvider.InterRegion.Available;
}
else
{
// assume local regions are always up
destRegionUp = true;
}
if(destRegionUp)
{ {
avatar.Close(); avatar.Close();
m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
position, false); position, false);
AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();