Merge branch 'ubitworkmaster'

avinationmerge
Melanie Thielker 2014-08-25 20:33:12 +02:00
commit 56081dc5e1
8 changed files with 585 additions and 474 deletions

View File

@ -134,6 +134,21 @@ namespace OpenSim.Framework
return true;
}
public void Remove(List<uint> ids)
{
LookupItem lookup;
foreach (uint localid in ids)
{
if (m_lookupTable.TryGetValue(localid, out lookup))
{
lookup.Heap.Remove(lookup.Handle);
m_lookupTable.Remove(localid);
}
}
}
/// <summary>
/// Remove an item from one of the queues. Specifically, it removes the
/// oldest item from the next queue in order to provide fair access to

View File

@ -1660,6 +1660,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// foreach (uint id in localIDs)
// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle);
// remove pending entities
lock (m_entityProps.SyncRoot)
m_entityProps.Remove(localIDs);
lock (m_entityUpdates.SyncRoot)
m_entityUpdates.Remove(localIDs);
KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
// TODO: don't create new blocks if recycling an old packet
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count];
@ -1671,28 +1677,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
kill.Header.Reliable = true;
kill.Header.Zerocoded = true;
if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null)
{
OutPacket(kill, ThrottleOutPacketType.Task);
}
else
{
// We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race
// condition where a kill can be processed before an out-of-date update for the same object.
// ProcessEntityUpdates() also takes the m_killRecord lock.
// lock (m_killRecord)
// {
// foreach (uint localID in localIDs)
// m_killRecord.Add(localID);
// The throttle queue used here must match that being used for updates. Otherwise, there is a
// chance that a kill packet put on a separate queue will be sent to the client before an existing
// update packet on another queue. Receiving updates after kills results in unowned and undeletable
// scene objects in a viewer until that viewer is relogged in.
OutPacket(kill, ThrottleOutPacketType.Task);
// }
}
}
OutPacket(kill, ThrottleOutPacketType.Task);
}
/// <summary>
/// Send information about the items contained in a folder to the client.
@ -5328,13 +5314,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Vector3 velocity = new Vector3(0, 0, 0);
Vector3 acceleration = new Vector3(0, 0, 0);
rotation.Normalize();
Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z);
data.CollisionPlane.ToBytes(objectData, 0);
offsetPosition.ToBytes(objectData, 16);
velocity.ToBytes(objectData, 28);
acceleration.ToBytes(objectData, 40);
vrot.ToBytes(objectData, 52);
rotation.ToBytes(objectData, 52);
data.AngularVelocity.ToBytes(objectData, 64);
ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
@ -5394,8 +5379,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Quaternion rotation = data.RotationOffset;
rotation.Normalize();
Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z);
vrot.ToBytes(objectData, 36);
rotation.ToBytes(objectData, 36);
data.AngularVelocity.ToBytes(objectData, 48);
ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();

View File

@ -981,10 +981,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// May need to logout or other cleanup
// AgentHasMovedAway(sp, logout);
AgentHasMovedAway(sp, true); // until logout use is checked
// AgentHasMovedAway(sp, true); // until logout use is checked
// Well, this is it. The agent is over there.
KillEntity(sp.Scene, sp.LocalId);
// KillEntity(sp.Scene, sp.LocalId);
sp.HasMovedAway();
// Now let's make it officially a child agent
sp.MakeChildAgent();
@ -1139,6 +1141,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
sp.HasMovedAway();
// Need to signal neighbours whether child agents may need closing irrespective of whether this
// one needed closing. We also need to close child agents as quickly as possible to avoid complicated
// race conditions with rapid agent releporting (e.g. from A1 to a non-neighbour B, back
@ -1147,12 +1151,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// abandoned without proper close by viewer but then re-used by an incoming connection.
sp.CloseChildAgents(newRegionX, newRegionY);
// May need to logout or other cleanup
// AgentHasMovedAway(sp, logout);
AgentHasMovedAway(sp, true);
// AgentHasMovedAway(sp, true);
// Well, this is it. The agent is over there.
KillEntity(sp.Scene, sp.LocalId);
// KillEntity(sp.Scene, sp.LocalId);
// Now let's make it officially a child agent
sp.MakeChildAgent();

View File

@ -576,6 +576,16 @@ namespace OpenSim.Region.Framework.Scenes.Animation
m_scenePresence.SendAnimPack(animations, seqs, objectIDs);
}
public void GetArrays(out UUID[] animIDs, out int[] sequenceNums, out UUID[] objectIDs)
{
animIDs = null;
sequenceNums = null;
objectIDs = null;
if(m_animations != null)
m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
}
public void SendAnimPackToClient(IClientAPI client)
{
if (m_scenePresence.IsChildAgent)

View File

@ -3000,13 +3000,18 @@ namespace OpenSim.Region.Framework.Scenes
if (sp == null)
{
m_log.DebugFormat(
"[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}",
client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos);
"[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}",
client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos,
((TPFlags)aCircuit.teleportFlags).ToString());
m_clientManager.Add(client);
SubscribeToClientEvents(client);
sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
/* done in completMovement
InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46);
if (cof == null)
sp.COF = UUID.Zero;
@ -3014,9 +3019,9 @@ namespace OpenSim.Region.Framework.Scenes
sp.COF = cof.ID;
m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF);
*/
m_eventManager.TriggerOnNewPresence(sp);
sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
}
else
{

View File

@ -2636,6 +2636,16 @@ namespace OpenSim.Region.Framework.Scenes
m_rootPart.UpdateFlag = UpdateRequired.TERSE;
}
if (IsAttachment)
{
ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar);
if (sp != null)
{
sp.SendAttachmentScheduleUpdate(this);
return;
}
}
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
@ -2697,15 +2707,25 @@ namespace OpenSim.Region.Framework.Scenes
return;
// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID);
RootPart.SendFullUpdateToAllClients();
if (IsAttachment)
{
ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar);
if (sp != null)
{
sp.SendAttachmentUpdate(this,UpdateRequired.FULL);
return;
}
}
RootPart.SendFullUpdateToAllClientsInternal();
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
if (part != RootPart)
part.SendFullUpdateToAllClients();
part.SendFullUpdateToAllClientsInternal();
}
}
@ -2739,9 +2759,19 @@ namespace OpenSim.Region.Framework.Scenes
if (IsDeleted)
return;
if (IsAttachment)
{
ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar);
if (sp != null)
{
sp.SendAttachmentUpdate(this, UpdateRequired.TERSE);
return;
}
}
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].SendTerseUpdateToAllClients();
parts[i].SendTerseUpdateToAllClientsInternal();
}
/// <summary>

View File

@ -862,7 +862,8 @@ namespace OpenSim.Region.Framework.Scenes
{
Vector3 offset = (m_offsetPosition - oldpos);
av.AbsolutePosition += offset;
av.SendAvatarDataToAllAgents();
// av.SendAvatarDataToAllAgents();
av.SendTerseUpdateToAllClients();
}
}
}
@ -3236,7 +3237,19 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat(
// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
if (ParentGroup.IsAttachment)
{
ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
if (sp != null)
{
sp.SendAttachmentUpdate(this, UpdateRequired.FULL);
}
}
/* this does nothing
SendFullUpdateToClient(remoteClient, Position) ignores position parameter
if (IsRoot)
{
if (ParentGroup.IsAttachment)
@ -3248,6 +3261,7 @@ namespace OpenSim.Region.Framework.Scenes
SendFullUpdateToClient(remoteClient, AbsolutePosition);
}
}
*/
else
{
SendFullUpdateToClient(remoteClient);
@ -3257,7 +3271,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Send a full update for this part to all clients.
/// </summary>
public void SendFullUpdateToAllClients()
public void SendFullUpdateToAllClientsInternal()
{
if (ParentGroup == null)
return;
@ -3276,6 +3290,36 @@ namespace OpenSim.Region.Framework.Scenes
});
}
public void SendFullUpdateToAllClients()
{
if (ParentGroup == null)
return;
// Update the "last" values
m_lastPosition = OffsetPosition;
m_lastRotation = RotationOffset;
m_lastVelocity = Velocity;
m_lastAcceleration = Acceleration;
m_lastAngularVelocity = AngularVelocity;
m_lastUpdateSentTime = Environment.TickCount;
if (ParentGroup.IsAttachment)
{
ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
if (sp != null)
{
sp.SendAttachmentUpdate(this, UpdateRequired.FULL);
}
}
else
{
ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
SendFullUpdate(avatar.ControllingClient);
});
}
}
/// <summary>
/// Sends a full update to the client
/// </summary>
@ -3345,24 +3389,24 @@ namespace OpenSim.Region.Framework.Scenes
!OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE)
{
SendTerseUpdateToAllClients();
SendTerseUpdateToAllClientsInternal();
}
break;
}
case UpdateRequired.FULL:
{
ClearUpdateSchedule();
SendFullUpdateToAllClients();
SendFullUpdateToAllClientsInternal();
break;
}
}
}
/// <summary>
/// Send a terse update to all clients
/// </summary>
public void SendTerseUpdateToAllClients()
public void SendTerseUpdateToAllClientsInternal()
{
if (ParentGroup == null || ParentGroup.Scene == null)
return;
@ -3381,6 +3425,36 @@ namespace OpenSim.Region.Framework.Scenes
});
}
public void SendTerseUpdateToAllClients()
{
if (ParentGroup == null || ParentGroup.Scene == null)
return;
// Update the "last" values
m_lastPosition = OffsetPosition;
m_lastRotation = RotationOffset;
m_lastVelocity = Velocity;
m_lastAcceleration = Acceleration;
m_lastAngularVelocity = AngularVelocity;
m_lastUpdateSentTime = Environment.TickCount;
if (ParentGroup.IsAttachment)
{
ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
if (sp != null)
{
sp.SendAttachmentUpdate(this, UpdateRequired.TERSE);
}
}
else
{
ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
{
SendTerseUpdateToClient(client);
});
}
}
public void SetAxisRotation(int axis, int rotate)
{
ParentGroup.SetAxisRotation(axis, rotate);

File diff suppressed because it is too large Load Diff