add a extra delay in EnableChildAgents between CreateAgent() return and

telling client to connect, to account for potencial async tasks that need
to finish before the client knocks at the door. Empirical value used
avinationmerge
UbitUmarov 2014-08-14 22:03:41 +01:00
parent 0ae8fed4c2
commit f798f04686
1 changed files with 14 additions and 5 deletions

View File

@ -1870,7 +1870,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (external != null) if (external != null)
{ {
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
d.BeginInvoke(sp, agent, region, external, true, d.BeginInvoke(sp, agent, region, external, true,true,
InformClientOfNeighbourCompleted, InformClientOfNeighbourCompleted,
d); d);
} }
@ -1880,7 +1880,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#region Enable Child Agents #region Enable Child Agents
private delegate void InformClientOfNeighbourDelegate( private delegate void InformClientOfNeighbourDelegate(
ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent); ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent, bool doInitialDelay);
/// <summary> /// <summary>
/// This informs all neighbouring regions about agent "avatar". /// This informs all neighbouring regions about agent "avatar".
@ -1993,6 +1993,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
bool newAgent = false; bool newAgent = false;
int count = 0; int count = 0;
bool delay = true;
foreach (GridRegion neighbour in neighbours) foreach (GridRegion neighbour in neighbours)
{ {
//m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName);
@ -2010,7 +2011,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Let's put this back at sync, so that it doesn't clog // Let's put this back at sync, so that it doesn't clog
// the network, especially for regions in the same physical server. // the network, especially for regions in the same physical server.
// We're really not in a hurry here. // We're really not in a hurry here.
InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent); InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, delay);
delay = false; // ugly i know.. but there aren't that many neighbours
//InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; //InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
//d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, //d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent,
// InformClientOfNeighbourCompleted, // InformClientOfNeighbourCompleted,
@ -2077,11 +2080,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <param name="endPoint"></param> /// <param name="endPoint"></param>
private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg,
IPEndPoint endPoint, bool newAgent) IPEndPoint endPoint, bool newAgent,bool doinitialdelay)
{ {
// Let's wait just a little to give time to originating regions to catch up with closing child agents // Let's wait just a little to give time to originating regions to catch up with closing child agents
// after a cross here // after a cross here
Thread.Sleep(500); if(doinitialdelay)
Thread.Sleep(500);
Scene scene = sp.Scene; Scene scene = sp.Scene;
@ -2097,6 +2101,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (regionAccepted && newAgent) if (regionAccepted && newAgent)
{ {
// give some time for createAgent finish possible async tasks
int dly = 100 - sp.ControllingClient.PingTimeMS;
if (dly > 20)
Thread.Sleep(dly);
if (m_eqModule != null) if (m_eqModule != null)
{ {
#region IP Translation for NAT #region IP Translation for NAT