Merge branch 'ubitworkmaster'

avinationmerge
Melanie Thielker 2014-08-11 18:45:39 +02:00
commit 22d472e34a
7 changed files with 114 additions and 96 deletions

View File

@ -139,6 +139,7 @@ namespace OpenSim.Framework.Capabilities
m_agentID = agent; m_agentID = agent;
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL); m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
m_regionName = regionName; m_regionName = regionName;
m_capsActive.Reset();
} }
/// <summary> /// <summary>
@ -263,7 +264,7 @@ namespace OpenSim.Framework.Capabilities
public bool WaitForActivation() public bool WaitForActivation()
{ {
// Wait for 30s. If that elapses, return false and run without caps // Wait for 30s. If that elapses, return false and run without caps
return m_capsActive.WaitOne(30000); return m_capsActive.WaitOne(120000);
} }
} }
} }

View File

@ -248,7 +248,19 @@ namespace OpenSim.Region.ClientStack.Linden
//m_capsHandlers["MapLayer"] = //m_capsHandlers["MapLayer"] =
// new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
// capsBase + m_mapLayerPath, // capsBase + m_mapLayerPath,
// GetMapLayer); // GetMapLayer);
IRequestHandler getObjectPhysicsDataHandler
= new RestStreamHandler(
"POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null);
m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost);
m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected);
m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
IRequestHandler req IRequestHandler req
= new RestStreamHandler( = new RestStreamHandler(
"POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null); "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null);
@ -283,14 +295,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
IRequestHandler getObjectPhysicsDataHandler
= new RestStreamHandler(
"POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null);
m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost);
m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected);
m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
IRequestHandler UpdateAgentInformationHandler IRequestHandler UpdateAgentInformationHandler
= new RestStreamHandler( = new RestStreamHandler(
@ -1379,6 +1384,17 @@ namespace OpenSim.Region.ClientStack.Linden
resp[uuid.ToString()] = object_data; resp[uuid.ToString()] = object_data;
} }
else
{
OSDMap object_data = new OSDMap();
object_data["linked_set_resource_cost"] = 0;
object_data["resource_cost"] = 0;
object_data["physics_cost"] = 0;
object_data["linked_set_physics_cost"] = 0;
resp[uuid.ToString()] = object_data;
}
} }
} }
@ -1443,7 +1459,7 @@ namespace OpenSim.Region.ClientStack.Linden
} }
} }
if (simul != 0) // if (simul != 0)
{ {
OSDMap object_data = new OSDMap(); OSDMap object_data = new OSDMap();

View File

@ -301,8 +301,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <remarks> /// <remarks>
/// This allows the outbound loop to only operate when there is data to send rather than continuously polling. /// This allows the outbound loop to only operate when there is data to send rather than continuously polling.
/// Some data is sent immediately and not queued. That data would not trigger this event. /// Some data is sent immediately and not queued. That data would not trigger this event.
/// WRONG use. May be usefull in future revision
/// </remarks> /// </remarks>
private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false); // private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
private Pool<IncomingPacket> m_incomingPacketPool; private Pool<IncomingPacket> m_incomingPacketPool;
@ -990,8 +991,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
PacketPool.Instance.ReturnPacket(packet); PacketPool.Instance.ReturnPacket(packet);
if (packetQueued) /// WRONG use. May be usefull in future revision
m_dataPresentEvent.Set(); // if (packetQueued)
// m_dataPresentEvent.Set();
} }
/// <summary> /// <summary>
@ -1418,6 +1420,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
queue.Enqueue(buffer); queue.Enqueue(buffer);
return; return;
} }
else if (packet.Type == PacketType.CompleteAgentMovement) else if (packet.Type == PacketType.CompleteAgentMovement)
{ {
// Send ack straight away to let the viewer know that we got it. // Send ack straight away to let the viewer know that we got it.
@ -2150,13 +2153,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// If nothing was sent, sleep for the minimum amount of time before a // If nothing was sent, sleep for the minimum amount of time before a
// token bucket could get more tokens // token bucket could get more tokens
//if (!m_packetSent)
// Thread.Sleep((int)TickCountResolution);
//
// Instead, now wait for data present to be explicitly signalled. Evidence so far is that with
// modern mono it reduces CPU base load since there is no more continuous polling.
if (!m_packetSent) if (!m_packetSent)
m_dataPresentEvent.WaitOne(100); Thread.Sleep((int)TickCountResolution);
// .... wrong core code removed
Watchdog.UpdateThread(); Watchdog.UpdateThread();
} }

View File

@ -366,8 +366,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// called on textures update // called on textures update
public bool UpdateBakedTextureCache(IScenePresence sp, WearableCacheItem[] cacheItems) public bool UpdateBakedTextureCache(IScenePresence sp, WearableCacheItem[] cacheItems)
{ {
bool defonly = true; // are we only using default textures
// uploaded baked textures will be in assets local cache // uploaded baked textures will be in assets local cache
IAssetService cache = m_scene.AssetService; IAssetService cache = m_scene.AssetService;
@ -409,8 +407,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
continue; continue;
} }
defonly = false; // found a non-default texture reference
if(sp.Appearance.Texture.FaceTextures[idx].TextureID == wearableCache[idx].TextureID) if(sp.Appearance.Texture.FaceTextures[idx].TextureID == wearableCache[idx].TextureID)
{ {
if(wearableCache[idx].CacheId != cacheItems[i].CacheId) if(wearableCache[idx].CacheId != cacheItems[i].CacheId)
@ -479,14 +475,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
sp.Appearance.WearableCacheItems[j].TextureID); sp.Appearance.WearableCacheItems[j].TextureID);
} }
// If we only found default textures, then the appearance is not cached return (hits == cacheItems.Length);
return (defonly ? false : true);
} }
// called when we get a new root avatar // called when we get a new root avatar
public bool ValidateBakedTextureCache(IScenePresence sp) public bool ValidateBakedTextureCache(IScenePresence sp)
{ {
bool defonly = true; // are we only using default textures
int hits = 0; int hits = 0;
lock (m_setAppearanceLock) lock (m_setAppearanceLock)
@ -556,10 +550,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
face = sp.Appearance.Texture.FaceTextures[idx]; face = sp.Appearance.Texture.FaceTextures[idx];
// this should be removed // this should be removed
if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) if (face.TextureID != UUID.Zero && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
{ hits++;
defonly = false; // found a non-default texture reference
}
continue; continue;
} }
@ -587,10 +579,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
} }
if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
{
defonly = false; // found a non-default texture reference
continue; continue;
}
if (wearableCache[idx].TextureID != face.TextureID) if (wearableCache[idx].TextureID != face.TextureID)
{ {
@ -603,7 +592,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
wearableCache[idx].TextureAsset = null; wearableCache[idx].TextureAsset = null;
if (cache != null) if (cache != null)
{ {
wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString()); wearableCache[idx].TextureAsset = m_scene.AssetService.GetCached(face.TextureID.ToString());
if (wearableCache[idx].TextureAsset == null) if (wearableCache[idx].TextureAsset == null)
{ {
wearableCache[idx].CacheId = UUID.Zero; wearableCache[idx].CacheId = UUID.Zero;
@ -618,7 +607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
sp.Appearance.WearableCacheItems = wearableCache; sp.Appearance.WearableCacheItems = wearableCache;
} }
m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2} {3}", sp.Name, sp.UUID, hits, defonly.ToString()); m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2}", sp.Name, sp.UUID, hits);
// debug // debug
for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++)
{ {
@ -629,9 +618,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
sp.Appearance.WearableCacheItems[j].TextureID); sp.Appearance.WearableCacheItems[j].TextureID);
} }
// If we only found default textures, then the appearance is not cached return (hits >= AvatarAppearance.BAKE_INDICES.Length - 1); // skirt is optional
return (defonly ? false : true);
} }
public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) public int RequestRebake(IScenePresence sp, bool missingTexturesOnly)
{ {
int texturesRebaked = 0; int texturesRebaked = 0;

View File

@ -1529,7 +1529,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos); GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos);
if (neighbourRegion == null) if (neighbourRegion == null)
{ {
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); agent.ControllingClient.SendAlertMessage("Cannot region cross into void");
return false; return false;
} }
@ -1680,7 +1680,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
neighbourRegion.RegionName, agent.Name); neighbourRegion.RegionName, agent.Name);
ReInstantiateScripts(agent); ReInstantiateScripts(agent);
agent.AddToPhysicalScene(isFlying); if(agent.ParentID == 0 && agent.ParentUUID == UUID.Zero)
agent.AddToPhysicalScene(isFlying);
return false; return false;
} }
@ -1749,8 +1750,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_entityTransferStateMachine.ResetFromTransit(agent.UUID); m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
// now we have a child agent in this region. Request all interesting data about other (root) agents // now we have a child agent in this region. Request all interesting data about other (root) agents
agent.SendOtherAgentsAvatarDataToMe();
agent.SendOtherAgentsAppearanceToMe(); // why do that? we either where a root having all that or we are leaving the area
// agent.SendOtherAgentsAvatarDataToMe();
// agent.SendOtherAgentsAppearanceToMe();
agent.parcelRegionCross(false);
// Backwards compatibility. Best effort // Backwards compatibility. Best effort
if (version == "Unknown" || version == string.Empty) if (version == "Unknown" || version == string.Empty)

View File

@ -1823,12 +1823,12 @@ namespace OpenSim.Region.Framework.Scenes
Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI);
m_callbackURI = null; m_callbackURI = null;
} }
// else // else
// { // {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}", // "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}",
// client.Name, client.AgentId, m_scene.RegionInfo.RegionName); // client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
// } // }
m_previusParcelHide = false; m_previusParcelHide = false;
m_previusParcelUUID = UUID.Zero; m_previusParcelUUID = UUID.Zero;
@ -1838,59 +1838,51 @@ namespace OpenSim.Region.Framework.Scenes
// send initial land overlay and parcel // send initial land overlay and parcel
ILandChannel landch = m_scene.LandChannel; ILandChannel landch = m_scene.LandChannel;
if (landch != null) if (landch != null)
{
landch.sendClientInitialLandInfo(client); landch.sendClientInitialLandInfo(client);
if (!IsChildAgent)
{
newhide = m_currentParcelHide;
m_currentParcelHide = false;
}
}
// send agentData to all clients including us (?) if (!IsChildAgent)
// get appearance
// if in cache sent it to all clients
// send what we have to us, even if not in cache ( bad? )
ValidateAndSendAppearanceAndAgentData();
// attachments
if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
{ {
if (Scene.AttachmentsModule != null) newhide = m_currentParcelHide;
m_currentParcelHide = false;
ValidateAndSendAppearanceAndAgentData();
// attachments
if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
{
if (Scene.AttachmentsModule != null)
// Util.FireAndForget( // Util.FireAndForget(
// o => // o =>
// { // {
Scene.AttachmentsModule.RezAttachments(this); Scene.AttachmentsModule.RezAttachments(this);
// }); // });
} }
else else
{
List<SceneObjectGroup> attachments = GetAttachments();
if (attachments.Count > 0)
{ {
m_log.DebugFormat( List<SceneObjectGroup> attachments = GetAttachments();
"[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
// Resume scripts this possible should also be moved down after sending the avatar to viewer ? if (attachments.Count > 0)
foreach (SceneObjectGroup sog in attachments)
{ {
sog.ScheduleGroupForFullUpdate(); m_log.DebugFormat(
sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
sog.ResumeScripts();
// Resume scripts this possible should also be moved down after sending the avatar to viewer ?
foreach (SceneObjectGroup sog in attachments)
{
sog.ScheduleGroupForFullUpdate();
sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
sog.ResumeScripts();
}
} }
} }
}
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
// Create child agents in neighbouring regions // Create child agents in neighbouring regions
if (openChildAgents && !IsChildAgent) if (openChildAgents)
{ {
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
if (m_agentTransfer != null) if (m_agentTransfer != null)
m_agentTransfer.EnableChildAgents(this); m_agentTransfer.EnableChildAgents(this);
}
} }
// send the rest of the world // send the rest of the world
@ -3871,7 +3863,7 @@ namespace OpenSim.Region.Framework.Scenes
protected bool CrossToNewRegion() protected bool CrossToNewRegion()
{ {
bool result = false; bool result = false;
parcelRegionCross(false); // parcelRegionCross(false);
try try
{ {
result = m_scene.CrossAgentToNewRegion(this, Flying); result = m_scene.CrossAgentToNewRegion(this, Flying);
@ -3880,8 +3872,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
result = m_scene.CrossAgentToNewRegion(this, false); result = m_scene.CrossAgentToNewRegion(this, false);
} }
if(!result) // if(!result)
parcelRegionCross(true); // parcelRegionCross(true);
return result; return result;
@ -5166,8 +5158,8 @@ namespace OpenSim.Region.Framework.Scenes
pos = land.LandData.UserLocation; pos = land.LandData.UserLocation;
} }
} }
// this is now done in completeMovement for all cases and not just this
land.SendLandUpdateToClient(ControllingClient); // land.SendLandUpdateToClient(ControllingClient);
} }
} }
@ -5539,7 +5531,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
private void parcelRegionCross(bool abort) public void parcelRegionCross(bool abort)
{ {
if (!ParcelHideThisAvatar) if (!ParcelHideThisAvatar)
return; return;
@ -5619,6 +5611,9 @@ namespace OpenSim.Region.Framework.Scenes
if (IsInTransit) if (IsInTransit)
return; return;
if (IsChildAgent)
return;
if (check) if (check)
{ {
// check is relative to current parcel only // check is relative to current parcel only

View File

@ -549,7 +549,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
return; return;
toRegionPos = presence.AbsolutePosition; toRegionPos = presence.AbsolutePosition;
dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); dis = Util.GetDistanceTo(toRegionPos, fromRegionPos);
if (presence.IsSatOnObject && presence.ParentPart != null &&
presence.ParentPart.ParentGroup != null &&
presence.ParentPart.ParentGroup.RootPart != null)
{
Vector3 rpos = presence.ParentPart.ParentGroup.RootPart.AbsolutePosition;
double dis2 = Util.GetDistanceTo(rpos, fromRegionPos);
if (dis > dis2)
dis = dis2;
}
// Disabled for now since all osNpc* methods check for appropriate ownership permission. // Disabled for now since all osNpc* methods check for appropriate ownership permission.
// Perhaps could be re-enabled as an NPC setting at some point since being able to make NPCs not // Perhaps could be re-enabled as an NPC setting at some point since being able to make NPCs not