Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-06-08 22:07:01 +01:00
commit 20ea823c19
6 changed files with 143 additions and 32 deletions

View File

@ -331,6 +331,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </value> /// </value>
protected HashSet<uint> m_killRecord; protected HashSet<uint> m_killRecord;
// protected HashSet<uint> m_attachmentsSent;
private int m_moneyBalance; private int m_moneyBalance;
private int m_animationSequenceNumber = 1; private int m_animationSequenceNumber = 1;
private bool m_SendLogoutPacketWhenClosing = true; private bool m_SendLogoutPacketWhenClosing = true;
@ -430,6 +432,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
m_killRecord = new HashSet<uint>(); m_killRecord = new HashSet<uint>();
// m_attachmentsSent = new HashSet<uint>();
m_assetService = m_scene.RequestModuleInterface<IAssetService>(); m_assetService = m_scene.RequestModuleInterface<IAssetService>();
m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
@ -3411,6 +3414,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
OutPacket(objupdate, ThrottleOutPacketType.Task); OutPacket(objupdate, ThrottleOutPacketType.Task);
// We need to record the avatar local id since the root prim of an attachment points to this.
// m_attachmentsSent.Add(avatar.LocalId);
} }
public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
@ -3542,9 +3548,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!canUseImproved && !canUseCompressed) if (!canUseImproved && !canUseCompressed)
{ {
if (update.Entity is ScenePresence) if (update.Entity is ScenePresence)
{
objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
}
else else
{
// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment)
// {
// SceneObjectPart sop = (SceneObjectPart)update.Entity;
// string text = sop.Text;
// if (text.IndexOf("\n") >= 0)
// text = text.Remove(text.IndexOf("\n"));
//
// if (m_attachmentsSent.Contains(sop.ParentID))
// {
//// m_log.DebugFormat(
//// "[CLIENT]: Sending full info about attached prim {0} text {1}",
//// sop.LocalId, text);
//
// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId));
//
// m_attachmentsSent.Add(sop.LocalId);
// }
// else
// {
// m_log.DebugFormat(
// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
// sop.LocalId, text, sop.ParentID);
//
// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
// }
// }
// else
// {
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
// }
}
} }
else if (!canUseImproved) else if (!canUseImproved)
{ {

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
@ -33,6 +33,15 @@ namespace OpenSim.Region.Framework.Scenes
{ {
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
/// viewer before child prim updates.
/// The adjustment is added to child prims and subtracted from root prims, so the gap ends up
/// being double. We do it both ways so that there is a still a priority delta even if the priority is already
/// double.MinValue or double.MaxValue.
/// </summary>
private double m_childPrimAdjustmentFactor = 0.05;
private Scene m_scene; private Scene m_scene;
public Prioritizer(Scene scene) public Prioritizer(Scene scene)
@ -42,21 +51,50 @@ namespace OpenSim.Region.Framework.Scenes
public double GetUpdatePriority(IClientAPI client, ISceneEntity entity) public double GetUpdatePriority(IClientAPI client, ISceneEntity entity)
{ {
double priority = 0;
switch (m_scene.UpdatePrioritizationScheme) switch (m_scene.UpdatePrioritizationScheme)
{ {
case UpdatePrioritizationSchemes.Time: case UpdatePrioritizationSchemes.Time:
return GetPriorityByTime(); priority = GetPriorityByTime();
break;
case UpdatePrioritizationSchemes.Distance: case UpdatePrioritizationSchemes.Distance:
return GetPriorityByDistance(client, entity); priority = GetPriorityByDistance(client, entity);
break;
case UpdatePrioritizationSchemes.SimpleAngularDistance: case UpdatePrioritizationSchemes.SimpleAngularDistance:
return GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance priority = GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance
break;
case UpdatePrioritizationSchemes.FrontBack: case UpdatePrioritizationSchemes.FrontBack:
return GetPriorityByFrontBack(client, entity); priority = GetPriorityByFrontBack(client, entity);
break;
case UpdatePrioritizationSchemes.BestAvatarResponsiveness: case UpdatePrioritizationSchemes.BestAvatarResponsiveness:
return GetPriorityByBestAvatarResponsiveness(client, entity); priority = GetPriorityByBestAvatarResponsiveness(client, entity);
break;
default: default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
break;
} }
// Adjust priority so that root prims are sent to the viewer first. This is especially important for
// attachments acting as huds, since current viewers fail to display hud child prims if their updates
// arrive before the root one.
if (entity is SceneObjectPart)
{
SceneObjectPart sop = ((SceneObjectPart)entity);
if (sop.IsRoot)
{
if (priority >= double.MinValue + m_childPrimAdjustmentFactor)
priority -= m_childPrimAdjustmentFactor;
}
else
{
if (priority <= double.MaxValue - m_childPrimAdjustmentFactor)
priority += m_childPrimAdjustmentFactor;
}
}
return priority;
} }
private double GetPriorityByTime() private double GetPriorityByTime()

View File

@ -2096,6 +2096,32 @@ namespace OpenSim.Region.Framework.Scenes
return sceneObject; return sceneObject;
} }
/// <summary>
/// Add an object into the scene that has come from storage
/// </summary>
///
/// <param name="sceneObject"></param>
/// <param name="attachToBackup">
/// If true, changes to the object will be reflected in its persisted data
/// If false, the persisted data will not be changed even if the object in the scene is changed
/// </param>
/// <param name="alreadyPersisted">
/// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately
/// </param>
/// <param name="sendClientUpdates">
/// If true, we send updates to the client to tell it about this object
/// If false, we leave it up to the caller to do this
/// </param>
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
public bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates);
}
/// <summary> /// <summary>
/// Add an object into the scene that has come from storage /// Add an object into the scene that has come from storage
/// </summary> /// </summary>
@ -2115,7 +2141,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool AddRestoredSceneObject( public bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
{ {
return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted); return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true);
} }
/// <summary> /// <summary>
@ -2555,7 +2581,10 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
sceneObject.RootPart.AddFlag(PrimFlags.Phantom); sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
AddRestoredSceneObject(sceneObject, false, false);
// Don't sent a full update here because this will cause full updates to be sent twice for
// attachments on region crossings, resulting in viewer glitches.
AddRestoredSceneObject(sceneObject, false, false, false);
// Handle attachment special case // Handle attachment special case
SceneObjectPart RootPrim = sceneObject.RootPart; SceneObjectPart RootPrim = sceneObject.RootPart;
@ -2582,12 +2611,13 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat( m_log.DebugFormat(
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
if (AttachmentsModule != null) if (AttachmentsModule != null)
AttachmentsModule.AttachObject( AttachmentsModule.AttachObject(
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez); //grp.SendGroupFullUpdate();
grp.SendGroupFullUpdate();
} }
else else
{ {

View File

@ -227,11 +227,15 @@ namespace OpenSim.Region.Framework.Scenes
/// If true, we won't persist this object until it changes /// If true, we won't persist this object until it changes
/// If false, we'll persist this object immediately /// If false, we'll persist this object immediately
/// </param> /// </param>
/// <param name="sendClientUpdates">
/// If true, we send updates to the client to tell it about this object
/// If false, we leave it up to the caller to do this
/// </param>
/// <returns> /// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene /// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns> /// </returns>
protected internal bool AddRestoredSceneObject( protected internal bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{ {
// KF: Check for out-of-region, move inside and make static. // KF: Check for out-of-region, move inside and make static.
Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X,
@ -263,7 +267,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.HasGroupChanged = true; sceneObject.HasGroupChanged = true;
} }
return AddSceneObject(sceneObject, attachToBackup, true); return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
} }
/// <summary> /// <summary>

View File

@ -2229,7 +2229,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ScheduleGroupForFullUpdate() public void ScheduleGroupForFullUpdate()
{ {
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID); if (IsAttachment)
m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
checkAtTargets(); checkAtTargets();
RootPart.ScheduleFullUpdate(); RootPart.ScheduleFullUpdate();

View File

@ -1177,12 +1177,12 @@
[Groups] [Groups]
Enabled = false Enabled = false
; This is the current groups stub in Region.CoreModules.Avatar.Groups ; This is the current groups stub in Region.CoreModules.Avatar.Groups. All the other settings below only really
; apply to the Flotsam/SimianGrid GroupsModule
Module = Default Module = Default
; The PHP code for the server is available from the Flotsam project for you to deploy ; This module can use a PHP XmlRpc server from the Flotsam project at http://code.google.com/p/flotsam/
; to your own server. The Flotsam project is located at http://code.google.com/p/flotsam/ ; or from the SimianGrid project at http://code.google.com/p/openmetaverse
;
;Module = GroupsModule ;Module = GroupsModule
; Enable Group Notices ; Enable Group Notices
@ -1195,17 +1195,17 @@
;MessagingModule = GroupsMessagingModule ;MessagingModule = GroupsMessagingModule
;MessagingEnabled = true ;MessagingEnabled = true
; Service connector to Groups Service [Select One] ServicesConnectorModule ; Service connectors to the Groups Service. Select one depending on whether you're using a Flotsam XmlRpc backend or a SimianGrid backend
; SimianGrid Service for Groups ; SimianGrid Service for Groups
;ServicesConnectorModule = SimianGroupsServicesConnector ;ServicesConnectorModule = SimianGroupsServicesConnector
;GroupsServerURI = http://mygridserver.com:82/Grid/ ;GroupsServerURI = http://mygridserver.com:82/Grid/
; XmlRpc Service Connector to the Flotsam XmlRpc Groups Service settings ; Flotsam XmlRpc Service for Groups
;ServicesConnectorModule = XmlRpcGroupsServicesConnector ;ServicesConnectorModule = XmlRpcGroupsServicesConnector
;GroupsServerURI = http://yourxmlrpcserver.com/xmlrpc.php ;GroupsServerURI = http://yourxmlrpcserver.com/xmlrpc.php
; XmlRpc Service Settings ; XmlRpc Security settings. These must match those set on your backend groups service.
;XmlRpcServiceReadKey = 1234 ;XmlRpcServiceReadKey = 1234
;XmlRpcServiceWriteKey = 1234 ;XmlRpcServiceWriteKey = 1234
@ -1213,7 +1213,6 @@
; this is a work around fora problem discovered on some Windows based region servers. ; this is a work around fora problem discovered on some Windows based region servers.
; Only disable keep alive if you see a large number (dozens) of the following Exceptions: ; Only disable keep alive if you see a large number (dozens) of the following Exceptions:
; System.Net.WebException: The request was aborted: The request was canceled. ; System.Net.WebException: The request was aborted: The request was canceled.
;
; XmlRpcDisableKeepAlive = false ; XmlRpcDisableKeepAlive = false