Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-09-06 18:58:57 +02:00
commit 402de5fb78
9 changed files with 196 additions and 177 deletions

View File

@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <param name="sp"></param> /// <param name="sp"></param>
/// <param name="position"></param> /// <param name="position"></param>
/// <param name="lookAt"></param> /// <param name="lookAt"></param>
/// <param name="teleportFlags"></param /// <param name="teleportFlags"></param>
private void TeleportAgentWithinRegion(ScenePresence sp, Vector3 position, Vector3 lookAt, uint teleportFlags) private void TeleportAgentWithinRegion(ScenePresence sp, Vector3 position, Vector3 lookAt, uint teleportFlags)
{ {
m_log.DebugFormat( m_log.DebugFormat(
@ -988,7 +988,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.IsInTransit = true; agent.IsInTransit = true;
CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
d.BeginInvoke(agent, newpos, x, y, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); d.BeginInvoke(agent, newpos, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
return true; return true;
} }
@ -1045,42 +1045,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
icon.EndInvoke(iar); icon.EndInvoke(iar);
} }
public bool CrossAgentToNewRegionPrep(ScenePresence agent, GridRegion neighbourRegion)
{
if (neighbourRegion == null)
return false;
m_entityTransferStateMachine.SetInTransit(agent.UUID);
agent.RemoveFromPhysicalScene();
return true;
}
/// <summary> /// <summary>
/// This Closes child agents on neighbouring regions /// This Closes child agents on neighbouring regions
/// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary> /// </summary>
public ScenePresence CrossAgentToNewRegionAsync( public ScenePresence CrossAgentToNewRegionAsync(
ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
bool isFlying, string version) bool isFlying, string version)
{ {
if (neighbourRegion == null) if (!CrossAgentToNewRegionPrep(agent, neighbourRegion))
return agent; return agent;
if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying))
return agent;
CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, version);
return agent;
}
public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying)
{
try try
{ {
m_entityTransferStateMachine.SetInTransit(agent.UUID);
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}",
agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
Scene m_scene = agent.Scene;
if (!agent.ValidateAttachments())
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.",
agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName);
pos = pos + agent.Velocity;
Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
agent.RemoveFromPhysicalScene();
AgentData cAgent = new AgentData(); AgentData cAgent = new AgentData();
agent.CopyTo(cAgent); agent.CopyTo(cAgent);
cAgent.Position = pos; cAgent.Position = pos + agent.Velocity;
if (isFlying) if (isFlying)
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
@ -1090,7 +1091,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Beyond this point, extra cleanup is needed beyond removing transit state // Beyond this point, extra cleanup is needed beyond removing transit state
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring);
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
{ {
// region doesn't take it // region doesn't take it
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
@ -1099,22 +1100,36 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.AddToPhysicalScene(isFlying); agent.AddToPhysicalScene(isFlying);
m_entityTransferStateMachine.ResetFromTransit(agent.UUID); m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
return agent; return false;
} }
//AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); }
catch (Exception e)
{
m_log.ErrorFormat(
"[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}",
agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace);
// TODO: Might be worth attempting other restoration here such as reinstantiation of scripts, etc.
return false;
}
return true;
}
public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
bool isFlying, string version)
{
agent.ControllingClient.RequestClientInfo(); agent.ControllingClient.RequestClientInfo();
//m_log.Debug("BEFORE CROSS");
//Scene.DumpChildrenSeeds(UUID);
//DumpKnownRegions();
string agentcaps; string agentcaps;
if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
{ {
m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
neighbourRegion.RegionHandle); neighbourRegion.RegionHandle);
return agent; return;
} }
// No turning back // No turning back
agent.IsChildAgent = true; agent.IsChildAgent = true;
@ -1122,15 +1137,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
if (m_eqModule != null) if (m_eqModule != null)
{ {
m_eqModule.CrossRegion( m_eqModule.CrossRegion(
neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint, neighbourRegion.RegionHandle, pos + agent.Velocity, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId); capsPath, agent.UUID, agent.ControllingClient.SessionId);
} }
else else
{ {
agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos + agent.Velocity, agent.Velocity, neighbourRegion.ExternalEndPoint,
capsPath); capsPath);
} }
@ -1159,6 +1176,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
// Next, let's close the child agent connections that are too far away. // Next, let's close the child agent connections that are too far away.
uint neighbourx;
uint neighboury;
Utils.LongToUInts(neighbourRegion.RegionHandle, out neighbourx, out neighboury);
neighbourx /= Constants.RegionSize;
neighboury /= Constants.RegionSize;
agent.CloseChildAgents(neighbourx, neighboury); agent.CloseChildAgents(neighbourx, neighboury);
AgentHasMovedAway(agent, false); AgentHasMovedAway(agent, false);
@ -1175,17 +1200,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
//m_log.Debug("AFTER CROSS"); //m_log.Debug("AFTER CROSS");
//Scene.DumpChildrenSeeds(UUID); //Scene.DumpChildrenSeeds(UUID);
//DumpKnownRegions(); //DumpKnownRegions();
}
catch (Exception e)
{
m_log.ErrorFormat(
"[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}",
agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace);
// TODO: Might be worth attempting other restoration here such as reinstantiation of scripts, etc. return;
}
return agent;
} }
private void CrossAgentToNewRegionCompleted(IAsyncResult iar) private void CrossAgentToNewRegionCompleted(IAsyncResult iar)

View File

@ -188,9 +188,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
args.Type = PollServiceEventArgs.EventType.LslHttp; args.Type = PollServiceEventArgs.EventType.LslHttp;
m_HttpServer.AddPollServiceHTTPHandler(uri, args); m_HttpServer.AddPollServiceHTTPHandler(uri, args);
m_log.DebugFormat( // m_log.DebugFormat(
"[URL MODULE]: Set up incoming request url {0} for {1} in {2} {3}", // "[URL MODULE]: Set up incoming request url {0} for {1} in {2} {3}",
uri, itemID, host.Name, host.LocalId); // uri, itemID, host.Name, host.LocalId);
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
} }
@ -234,9 +234,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
args.Type = PollServiceEventArgs.EventType.LslHttp; args.Type = PollServiceEventArgs.EventType.LslHttp;
m_HttpsServer.AddPollServiceHTTPHandler(uri, args); m_HttpsServer.AddPollServiceHTTPHandler(uri, args);
m_log.DebugFormat( // m_log.DebugFormat(
"[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}", // "[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}",
uri, itemID, host.Name, host.LocalId); // uri, itemID, host.Name, host.LocalId);
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
} }

View File

@ -35,7 +35,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version); public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version);
public interface IEntityTransferModule public interface IEntityTransferModule
{ {
@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Interfaces
void Cross(SceneObjectGroup sog, Vector3 position, bool silent); void Cross(SceneObjectGroup sog, Vector3 position, bool silent);
ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version); ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version);
} }

View File

@ -581,7 +581,7 @@ namespace OpenSim.Region.Framework.Scenes
av.IsInTransit = true; av.IsInTransit = true;
CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d);
} }
else else
m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val); m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val);

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

@ -438,6 +438,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
// Extra statistics that aren't currently sent to clients // Extra statistics that aren't currently sent to clients
if (m_scene.PhysicsScene != null)
{
lock (m_lastReportedExtraSimStats) lock (m_lastReportedExtraSimStats)
{ {
m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
@ -458,6 +460,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
}
// LastReportedObjectUpdates = m_objectUpdates / m_statsUpdateFactor; // LastReportedObjectUpdates = m_objectUpdates / m_statsUpdateFactor;
ResetValues(); ResetValues();

View File

@ -181,8 +181,7 @@ namespace OpenSim.Services.Connectors
public AssetBase Get(string id) public AssetBase Get(string id)
{ {
// string uri = MapServer(id) + "/assets/" + id; string uri = Path.Combine(MapServer(id), Path.Combine("assets", id));
string uri = MapServer(id) + "assets/" + id;
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
@ -219,8 +218,7 @@ namespace OpenSim.Services.Connectors
return fullAsset.Metadata; return fullAsset.Metadata;
} }
// string uri = MapServer(id) + "/assets/" + id + "/metadata"; string uri = Path.Combine(MapServer(id), Path.Combine("assets", id));
string uri = MapServer(id) + "assets/" + id + "/metadata";
AssetMetadata asset = SynchronousRestObjectRequester. AssetMetadata asset = SynchronousRestObjectRequester.
MakeRequest<int, AssetMetadata>("GET", uri, 0); MakeRequest<int, AssetMetadata>("GET", uri, 0);
@ -262,8 +260,7 @@ namespace OpenSim.Services.Connectors
public bool Get(string id, Object sender, AssetRetrieved handler) public bool Get(string id, Object sender, AssetRetrieved handler)
{ {
// string uri = MapServer(id) + "/assets/" + id; string uri = Path.Combine(MapServer(id), Path.Combine("assets", id));
string uri = MapServer(id) + "assets/" + id;
AssetBase asset = null; AssetBase asset = null;
if (m_Cache != null) if (m_Cache != null)
@ -382,9 +379,9 @@ namespace OpenSim.Services.Connectors
return asset.ID; return asset.ID;
} }
// string uri = MapServer(asset.FullID.ToString()) + "/assets/"; string uri = Path.Combine(MapServer(asset.FullID.ToString()), "/assets/");
if (!uri.EndsWith("/"))
string uri = MapServer(asset.FullID.ToString()) + "assets/"; uri += "/";
string newID = string.Empty; string newID = string.Empty;
try try
@ -461,8 +458,7 @@ namespace OpenSim.Services.Connectors
} }
asset.Data = data; asset.Data = data;
// string uri = MapServer(id) + "/assets/" + id; string uri = Path.Combine(MapServer(id), Path.Combine("assets", id));
string uri = MapServer(id) + "assets/" + id;
if (SynchronousRestObjectRequester. if (SynchronousRestObjectRequester.
MakeRequest<AssetBase, bool>("POST", uri, asset)) MakeRequest<AssetBase, bool>("POST", uri, asset))
@ -477,8 +473,7 @@ namespace OpenSim.Services.Connectors
public bool Delete(string id) public bool Delete(string id)
{ {
// string uri = MapServer(id) + "/assets/" + id; string uri = Path.Combine(MapServer(id), Path.Combine("assets", id));
string uri = MapServer(id) + "assets/" + id;
if (SynchronousRestObjectRequester. if (SynchronousRestObjectRequester.
MakeRequest<int, bool>("DELETE", uri, 0)) MakeRequest<int, bool>("DELETE", uri, 0))

View File

@ -144,10 +144,11 @@ namespace OpenSim.Services.Connectors.Friends
private bool Call(GridRegion region, Dictionary<string, object> sendData) private bool Call(GridRegion region, Dictionary<string, object> sendData)
{ {
Util.FireAndForget(x => {
string reqString = ServerUtils.BuildQueryString(sendData); string reqString = ServerUtils.BuildQueryString(sendData);
//m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString); //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString);
if (region == null) if (region == null)
return false; return;
string path = ServicePath(); string path = ServicePath();
if (!region.ServerURI.EndsWith("/")) if (!region.ServerURI.EndsWith("/"))
@ -164,10 +165,10 @@ namespace OpenSim.Services.Connectors.Friends
if (replyData.ContainsKey("RESULT")) if (replyData.ContainsKey("RESULT"))
{ {
if (replyData["RESULT"].ToString().ToLower() == "true") // if (replyData["RESULT"].ToString().ToLower() == "true")
return true; // return;
else // else
return false; return;
} }
else else
m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field"); m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field");
@ -181,7 +182,10 @@ namespace OpenSim.Services.Connectors.Friends
m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message); 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,7 +395,7 @@ 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
@ -406,6 +406,7 @@ namespace OpenSim.Services.Connectors.Simulation
{ {
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;
} }