Make friend notifies and closing child agents async because both can

block the heartbeat thread if the sim being contacted is unresponsive
avinationmerge
Melanie 2012-09-04 22:53:52 +02:00
parent 8a537f8f66
commit 9ae293881a
3 changed files with 45 additions and 40 deletions

View File

@ -3432,7 +3432,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="e"></param> /// <param name="e"></param>
public void PhysicsCollisionUpdate(EventArgs e) public void PhysicsCollisionUpdate(EventArgs e)
{ {
if (IsChildAgent) if (IsChildAgent || Animator == null)
return; return;
//if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))

View File

@ -144,44 +144,48 @@ namespace OpenSim.Services.Connectors.Friends
private bool Call(GridRegion region, Dictionary<string, object> sendData) private bool Call(GridRegion region, Dictionary<string, object> sendData)
{ {
string reqString = ServerUtils.BuildQueryString(sendData); Util.FireAndForget(x => {
//m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString); string reqString = ServerUtils.BuildQueryString(sendData);
if (region == null) //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString);
return false; if (region == null)
return;
string path = ServicePath(); string path = ServicePath();
if (!region.ServerURI.EndsWith("/")) if (!region.ServerURI.EndsWith("/"))
path = "/" + path; path = "/" + path;
string uri = region.ServerURI + path; string uri = region.ServerURI + path;
m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri);
try try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
if (reply != string.Empty)
if (replyData.ContainsKey("RESULT"))
{ {
if (replyData["RESULT"].ToString().ToLower() == "true") Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
return true;
if (replyData.ContainsKey("RESULT"))
{
// if (replyData["RESULT"].ToString().ToLower() == "true")
// return;
// else
return;
}
else else
return false; m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field");
} }
else else
m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field"); m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply");
}
catch (Exception e)
{
m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message);
} }
else
m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply");
}
catch (Exception e)
{
m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message);
}
return false; return;
});
return true;
} }
} }
} }

View File

@ -395,17 +395,18 @@ namespace OpenSim.Services.Connectors.Simulation
private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
{ {
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start");
Util.FireAndForget(x => {
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; try
{
try WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false);
{ }
WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); catch (Exception e)
} {
catch (Exception e) m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString());
{ }
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString()); });
}
return true; return true;
} }