aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-03-13 00:22:38 +0000
committerJustin Clarke Casey2008-03-13 00:22:38 +0000
commita4304fb9e6ec94b9a2aa70db85a68b9b102d4c33 (patch)
tree0b98401a00ff68bebdf2f7de385386e6a5060fff
parent* Updated LibSL _packets_.cs to latest revision. AKA New Packets. (diff)
downloadopensim-SC_OLD-a4304fb9e6ec94b9a2aa70db85a68b9b102d4c33.zip
opensim-SC_OLD-a4304fb9e6ec94b9a2aa70db85a68b9b102d4c33.tar.gz
opensim-SC_OLD-a4304fb9e6ec94b9a2aa70db85a68b9b102d4c33.tar.bz2
opensim-SC_OLD-a4304fb9e6ec94b9a2aa70db85a68b9b102d4c33.tar.xz
* Fix Mantis 761 (linking and delinking prims rapidly caused prims to 'disappear')
* Root cause was that if two updates occurred in the same second of time, the second one was never sent * Linking/delinking appears to be okay now
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs30
5 files changed, 55 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index e195c92..0272a7e 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -206,6 +206,12 @@ namespace OpenSim.Region.Environment.Scenes
206 } 206 }
207 } 207 }
208 208
209 /// <summary>
210 /// Add an entity to the list of prims to process on the next update
211 /// </summary>
212 /// <param name="obj">
213 /// A <see cref="EntityBase"/>
214 /// </param>
209 internal void AddToUpdateList(EntityBase obj) 215 internal void AddToUpdateList(EntityBase obj)
210 { 216 {
211 lock (m_updateList) 217 lock (m_updateList)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 1a73e78..7ea528c 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -614,7 +614,7 @@ namespace OpenSim.Region.Environment.Scenes
614 } 614 }
615 615
616 /// <summary> 616 /// <summary>
617 /// 617 /// Start the timer which triggers regular scene updates
618 /// </summary> 618 /// </summary>
619 public void StartTimer() 619 public void StartTimer()
620 { 620 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 1a32460..50dc2ae 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -247,9 +247,11 @@ namespace OpenSim.Region.Environment.Scenes
247 public SceneObjectGroup(Scene scene, ulong regionHandle, SceneObjectPart part) 247 public SceneObjectGroup(Scene scene, ulong regionHandle, SceneObjectPart part)
248 { 248 {
249 m_scene = scene; 249 m_scene = scene;
250
250 part.SetParent(this); 251 part.SetParent(this);
251 part.ParentID = 0; 252 part.ParentID = 0;
252 part.LinkNum = 0; 253 part.LinkNum = 0;
254
253 m_parts.Add(part.UUID, part); 255 m_parts.Add(part.UUID, part);
254 256
255 SetPartAsRoot(part); 257 SetPartAsRoot(part);
@@ -691,7 +693,7 @@ namespace OpenSim.Region.Environment.Scenes
691 #region Scheduling 693 #region Scheduling
692 694
693 /// <summary> 695 /// <summary>
694 /// 696 /// Examine this object's parts to see if they've changed sufficiently to warrant an update
695 /// </summary> 697 /// </summary>
696 public override void Update() 698 public override void Update()
697 { 699 {
@@ -703,6 +705,7 @@ namespace OpenSim.Region.Environment.Scenes
703 } 705 }
704 lastPhysGroupPos = AbsolutePosition; 706 lastPhysGroupPos = AbsolutePosition;
705 } 707 }
708
706 if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) 709 if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
707 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) 710 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
708 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) 711 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
@@ -714,6 +717,7 @@ namespace OpenSim.Region.Environment.Scenes
714 } 717 }
715 lastPhysGroupRot = GroupRotation; 718 lastPhysGroupRot = GroupRotation;
716 } 719 }
720
717 foreach (SceneObjectPart part in m_parts.Values) 721 foreach (SceneObjectPart part in m_parts.Values)
718 { 722 {
719 part.SendScheduledUpdates(); 723 part.SendScheduledUpdates();
@@ -737,7 +741,7 @@ namespace OpenSim.Region.Environment.Scenes
737 } 741 }
738 742
739 /// <summary> 743 /// <summary>
740 /// 744 /// Schedule a full update for every part in this object
741 /// </summary> 745 /// </summary>
742 public void ScheduleGroupForFullUpdate() 746 public void ScheduleGroupForFullUpdate()
743 { 747 {
@@ -910,6 +914,7 @@ namespace OpenSim.Region.Environment.Scenes
910 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 914 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
911 915
912 linkPart.ParentID = m_rootPart.LocalId; 916 linkPart.ParentID = m_rootPart.LocalId;
917
913 linkPart.LinkNum = m_parts.Count; 918 linkPart.LinkNum = m_parts.Count;
914 919
915 m_parts.Add(linkPart.UUID, linkPart); 920 m_parts.Add(linkPart.UUID, linkPart);
@@ -1015,7 +1020,7 @@ namespace OpenSim.Region.Environment.Scenes
1015 //m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true); 1020 //m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true);
1016 //} 1021 //}
1017 1022
1018 SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart); 1023 SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart);
1019 1024
1020 m_scene.AddEntity(objectGroup); 1025 m_scene.AddEntity(objectGroup);
1021 1026
@@ -1715,6 +1720,9 @@ namespace OpenSim.Region.Environment.Scenes
1715 m_scene.EventManager.TriggerGroupGrab(UUID, offsetPos, remoteClient.AgentId); 1720 m_scene.EventManager.TriggerGroupGrab(UUID, offsetPos, remoteClient.AgentId);
1716 } 1721 }
1717 1722
1723 /// <summary>
1724 /// Completely delete this group and tell all the scene presences about that deletion.
1725 /// </summary>
1718 public void DeleteGroup() 1726 public void DeleteGroup()
1719 { 1727 {
1720 DetachFromBackup(this); 1728 DetachFromBackup(this);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index f20a638..b708d04 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -132,7 +132,12 @@ namespace OpenSim.Region.Environment.Scenes
132 [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn 132 [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
133 133
134 /// <summary> 134 /// <summary>
135 /// Only used internally to schedule client updates 135 /// Only used internally to schedule client updates.
136 /// 0 - no update is scheduled
137 /// 1 - terse update scheduled
138 /// 2 - full update scheduled
139 ///
140 /// TODO - This should be an enumeration
136 /// </summary> 141 /// </summary>
137 private byte m_updateFlag; 142 private byte m_updateFlag;
138 143
@@ -1090,7 +1095,7 @@ namespace OpenSim.Region.Environment.Scenes
1090 #region Update Scheduling 1095 #region Update Scheduling
1091 1096
1092 /// <summary> 1097 /// <summary>
1093 /// 1098 /// Clear all pending updates
1094 /// </summary> 1099 /// </summary>
1095 private void ClearUpdateSchedule() 1100 private void ClearUpdateSchedule()
1096 { 1101 {
@@ -1098,7 +1103,7 @@ namespace OpenSim.Region.Environment.Scenes
1098 } 1103 }
1099 1104
1100 /// <summary> 1105 /// <summary>
1101 /// 1106 /// Schedules this prim for a full update
1102 /// </summary> 1107 /// </summary>
1103 public void ScheduleFullUpdate() 1108 public void ScheduleFullUpdate()
1104 { 1109 {
@@ -1107,6 +1112,7 @@ namespace OpenSim.Region.Environment.Scenes
1107 m_parentGroup.HasGroupChanged = true; 1112 m_parentGroup.HasGroupChanged = true;
1108 m_parentGroup.QueueForUpdateCheck(); 1113 m_parentGroup.QueueForUpdateCheck();
1109 } 1114 }
1115
1110 TimeStampFull = (uint) Util.UnixTimeSinceEpoch(); 1116 TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
1111 m_updateFlag = 2; 1117 m_updateFlag = 2;
1112 } 1118 }
@@ -1156,7 +1162,7 @@ namespace OpenSim.Region.Environment.Scenes
1156 } 1162 }
1157 1163
1158 /// <summary> 1164 /// <summary>
1159 /// 1165 /// Tell all the prims which have had updates scheduled
1160 /// </summary> 1166 /// </summary>
1161 public void SendScheduledUpdates() 1167 public void SendScheduledUpdates()
1162 { 1168 {
@@ -1688,7 +1694,10 @@ namespace OpenSim.Region.Environment.Scenes
1688 } 1694 }
1689 1695
1690 #region Client Update Methods 1696 #region Client Update Methods
1691 1697
1698 /// <summary>
1699 /// Tell all scene presences that they should send updates for this part to their clients
1700 /// </summary>
1692 public void AddFullUpdateToAllAvatars() 1701 public void AddFullUpdateToAllAvatars()
1693 { 1702 {
1694 List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); 1703 List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
@@ -1697,6 +1706,7 @@ namespace OpenSim.Region.Environment.Scenes
1697 avatars[i].QueuePartForUpdate(this); 1706 avatars[i].QueuePartForUpdate(this);
1698 } 1707 }
1699 } 1708 }
1709
1700 public void SendFullUpdateToAllClientsExcept(LLUUID agentID) 1710 public void SendFullUpdateToAllClientsExcept(LLUUID agentID)
1701 { 1711 {
1702 List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); 1712 List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
@@ -1710,6 +1720,8 @@ namespace OpenSim.Region.Environment.Scenes
1710 } 1720 }
1711 } 1721 }
1712 } 1722 }
1723
1724
1713 public void AddFullUpdateToAvatar(ScenePresence presence) 1725 public void AddFullUpdateToAvatar(ScenePresence presence)
1714 { 1726 {
1715 presence.QueuePartForUpdate(this); 1727 presence.QueuePartForUpdate(this);
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index fc13ebb..2f35fe3 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -418,6 +418,10 @@ namespace OpenSim.Region.Environment.Scenes
418 418
419 #endregion 419 #endregion
420 420
421 /// <summary>
422 /// Add the part to the queue of parts for which we need to send an update to the client
423 /// </summary>
424 /// <param name="part"></param>
421 public void QueuePartForUpdate(SceneObjectPart part) 425 public void QueuePartForUpdate(SceneObjectPart part)
422 { 426 {
423 //if (InterestList.Contains(part.ParentGroup)) 427 //if (InterestList.Contains(part.ParentGroup))
@@ -434,6 +438,11 @@ namespace OpenSim.Region.Environment.Scenes
434 return m_scene.PermissionsMngr.GenerateClientFlags(m_uuid, ObjectID); 438 return m_scene.PermissionsMngr.GenerateClientFlags(m_uuid, ObjectID);
435 } 439 }
436 440
441 /// <summary>
442 /// Send updates to the client about prims which have been placed on the update queue. We don't
443 /// necessarily send updates for all the parts on the queue, e.g. if an updates with a more recent
444 /// timestamp has already been sent.
445 /// </summary>
437 public void SendPrimUpdates() 446 public void SendPrimUpdates()
438 { 447 {
439 // if (m_scene.QuadTree.GetNodeID(this.AbsolutePosition.X, this.AbsolutePosition.Y) != m_currentQuadNode) 448 // if (m_scene.QuadTree.GetNodeID(this.AbsolutePosition.X, this.AbsolutePosition.Y) != m_currentQuadNode)
@@ -446,13 +455,12 @@ namespace OpenSim.Region.Environment.Scenes
446 if (!m_gotAllObjectsInScene) 455 if (!m_gotAllObjectsInScene)
447 { 456 {
448 if (!m_isChildAgent || m_scene.m_seeIntoRegionFromNeighbor) 457 if (!m_isChildAgent || m_scene.m_seeIntoRegionFromNeighbor)
449 { 458 {
450
451 m_scene.SendAllSceneObjectsToClient(this); 459 m_scene.SendAllSceneObjectsToClient(this);
452 m_gotAllObjectsInScene = true; 460 m_gotAllObjectsInScene = true;
453
454 } 461 }
455 } 462 }
463
456 if (m_partsUpdateQueue.Count > 0) 464 if (m_partsUpdateQueue.Count > 0)
457 { 465 {
458 bool runUpdate = true; 466 bool runUpdate = true;
@@ -465,16 +473,18 @@ namespace OpenSim.Region.Environment.Scenes
465 ScenePartUpdate update = m_updateTimes[part.UUID]; 473 ScenePartUpdate update = m_updateTimes[part.UUID];
466 474
467 // Two updates can occur with the same timestamp (especially 475 // Two updates can occur with the same timestamp (especially
468 // since our timestamp resolution is to the nearest second). The first 476 // since our timestamp resolution is to the nearest second). Therefore, we still need
469 // could have been sent in the last update - we still need to send the 477 // to send an update even if the last full update time is identical to the part's
470 // second here. 478 // update timestamp.
471 479 //
472 if (update.LastFullUpdateTime < part.TimeStampFull) 480 // If we don't do this, various events (such as linking and delinking in the same
481 // second), will stop working properly!
482 if (update.LastFullUpdateTime <= part.TimeStampFull)
473 { 483 {
474 //need to do a full update 484 //need to do a full update
475 part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); 485 part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID));
476 486
477 // We'll update to the part's timestamp rather than the current to 487 // We'll update to the part's timestamp rather than the current time to
478 // avoid the race condition whereby the next tick occurs while we are 488 // avoid the race condition whereby the next tick occurs while we are
479 // doing this update. If this happened, then subsequent updates which occurred 489 // doing this update. If this happened, then subsequent updates which occurred
480 // on the same tick or the next tick of the last update would be ignored. 490 // on the same tick or the next tick of the last update would be ignored.