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_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
m_regionName = regionName;
m_capsActive.Reset();
}
/// <summary>
@ -263,7 +264,7 @@ namespace OpenSim.Framework.Capabilities
public bool WaitForActivation()
{
// 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"] =
// new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
// 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
= new RestStreamHandler(
"POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null);
@ -283,14 +295,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", 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
= new RestStreamHandler(
@ -1379,6 +1384,17 @@ namespace OpenSim.Region.ClientStack.Linden
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();

View File

@ -301,8 +301,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <remarks>
/// 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.
/// WRONG use. May be usefull in future revision
/// </remarks>
private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
// private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
private Pool<IncomingPacket> m_incomingPacketPool;
@ -990,8 +991,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
PacketPool.Instance.ReturnPacket(packet);
if (packetQueued)
m_dataPresentEvent.Set();
/// WRONG use. May be usefull in future revision
// if (packetQueued)
// m_dataPresentEvent.Set();
}
/// <summary>
@ -1418,6 +1420,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
queue.Enqueue(buffer);
return;
}
else if (packet.Type == PacketType.CompleteAgentMovement)
{
// 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
// 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)
m_dataPresentEvent.WaitOne(100);
Thread.Sleep((int)TickCountResolution);
// .... wrong core code removed
Watchdog.UpdateThread();
}

View File

@ -366,8 +366,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// called on textures update
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
IAssetService cache = m_scene.AssetService;
@ -409,8 +407,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
continue;
}
defonly = false; // found a non-default texture reference
if(sp.Appearance.Texture.FaceTextures[idx].TextureID == wearableCache[idx].TextureID)
{
if(wearableCache[idx].CacheId != cacheItems[i].CacheId)
@ -479,14 +475,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
sp.Appearance.WearableCacheItems[j].TextureID);
}
// If we only found default textures, then the appearance is not cached
return (defonly ? false : true);
return (hits == cacheItems.Length);
}
// called when we get a new root avatar
public bool ValidateBakedTextureCache(IScenePresence sp)
{
bool defonly = true; // are we only using default textures
int hits = 0;
lock (m_setAppearanceLock)
@ -556,10 +550,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
face = sp.Appearance.Texture.FaceTextures[idx];
// this should be removed
if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
{
defonly = false; // found a non-default texture reference
}
if (face.TextureID != UUID.Zero && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
hits++;
continue;
}
@ -587,10 +579,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
{
defonly = false; // found a non-default texture reference
continue;
}
if (wearableCache[idx].TextureID != face.TextureID)
{
@ -603,7 +592,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
wearableCache[idx].TextureAsset = 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)
{
wearableCache[idx].CacheId = UUID.Zero;
@ -618,7 +607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
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
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);
}
// If we only found default textures, then the appearance is not cached
return (defonly ? false : true);
return (hits >= AvatarAppearance.BAKE_INDICES.Length - 1); // skirt is optional
}
public int RequestRebake(IScenePresence sp, bool missingTexturesOnly)
{
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);
if (neighbourRegion == null)
{
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
agent.ControllingClient.SendAlertMessage("Cannot region cross into void");
return false;
}
@ -1680,7 +1680,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
neighbourRegion.RegionName, agent.Name);
ReInstantiateScripts(agent);
agent.AddToPhysicalScene(isFlying);
if(agent.ParentID == 0 && agent.ParentUUID == UUID.Zero)
agent.AddToPhysicalScene(isFlying);
return false;
}
@ -1749,8 +1750,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
// 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
if (version == "Unknown" || version == string.Empty)

View File

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

View File

@ -549,7 +549,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
return;
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.
// Perhaps could be re-enabled as an NPC setting at some point since being able to make NPCs not