* All CheckRegion within an instance would use the same, global, bool for 'Available', which would lead to intermittent failures on parallell teleport requests.
* Solidified CheckRegion somewhat, adding a second try if the first failed.0.6.0-stable
parent
97d5b5a1eb
commit
22f09fbd21
|
@ -32,8 +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 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, int XMLMethod);
|
bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData, int XMLMethod);
|
||||||
bool RegionUp(SerializableRegionInfo region, ulong regionhandle);
|
bool RegionUp(SerializableRegionInfo region, ulong regionhandle);
|
||||||
|
|
|
@ -51,16 +51,9 @@ namespace OpenSim.Region.Communications.Local
|
||||||
|
|
||||||
public string _gdebugRegionName = String.Empty;
|
public string _gdebugRegionName = String.Empty;
|
||||||
|
|
||||||
bool m_bAvailable=true;
|
public bool CheckRegion(string address, uint port)
|
||||||
|
|
||||||
public void CheckRegion(string address, uint port)
|
|
||||||
{
|
{
|
||||||
m_bAvailable = true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
public bool Available
|
|
||||||
{
|
|
||||||
get { return m_bAvailable; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string gdebugRegionName
|
public string gdebugRegionName
|
||||||
|
|
|
@ -1558,36 +1558,60 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
bool m_bAvailable = false;
|
bool m_bAvailable = false;
|
||||||
int timeOut = 10; //10 seconds
|
int timeOut = 10; //10 seconds
|
||||||
|
|
||||||
public void CheckRegion(string address, uint port)
|
public bool CheckRegion(string address, uint port, bool retry)
|
||||||
{
|
{
|
||||||
m_bAvailable = false;
|
bool available = false;
|
||||||
IPAddress ia = null;
|
bool timed_out = true;
|
||||||
|
|
||||||
|
IPAddress ia;
|
||||||
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);
|
|
||||||
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
|
||||||
IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket);
|
|
||||||
ar.AsyncWaitHandle.WaitOne(timeOut*1000, false);
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Available
|
AsyncCallback callback = delegate(IAsyncResult iar)
|
||||||
{
|
{
|
||||||
get { return m_bAvailable; }
|
Socket s = (Socket)iar.AsyncState;
|
||||||
}
|
try
|
||||||
|
{
|
||||||
|
s.EndConnect(iar);
|
||||||
|
available = true;
|
||||||
|
timed_out = false;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("Callback EndConnect exception: {0}:{1}", e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
|
||||||
|
s.Close();
|
||||||
|
};
|
||||||
|
|
||||||
void ConnectedMethod(IAsyncResult ar)
|
|
||||||
{
|
|
||||||
Socket socket = (Socket)ar.AsyncState;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
socket.EndConnect(ar);
|
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
m_bAvailable = true;
|
IAsyncResult ar = socket.BeginConnect(m_EndPoint, callback, socket);
|
||||||
|
ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
socket.Close();
|
|
||||||
|
if (timed_out)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("socket [{0}] timed out ({1}) waiting to obtain a connection.", m_EndPoint, timeOut * 1000);
|
||||||
|
|
||||||
|
if (retry)
|
||||||
|
{
|
||||||
|
return CheckRegion(address, port, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return available;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CheckRegion(string address, uint port)
|
||||||
|
{
|
||||||
|
return CheckRegion(address, port, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NoteDeadRegion(ulong regionhandle)
|
public void NoteDeadRegion(ulong regionhandle)
|
||||||
|
|
|
@ -580,8 +580,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (reg.RemotingAddress != "" && reg.RemotingPort != 0)
|
if (reg.RemotingAddress != "" && reg.RemotingPort != 0)
|
||||||
{
|
{
|
||||||
// region is remote. see if it is up
|
// region is remote. see if it is up
|
||||||
m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort);
|
destRegionUp = m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort);
|
||||||
destRegionUp = m_commsProvider.InterRegion.Available;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue