aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2014-08-21 02:38:57 +0200
committerMelanie Thielker2014-08-21 02:38:57 +0200
commitf06f13b59dd7261bfdcee59b546431fe47dcc635 (patch)
tree81cdfa2c9d8064708a5d6e4543b5ba90a3513e41 /OpenSim/Region
parentMerge branch 'ubitworkmaster' (diff)
parentadd a direct sendpartfullUpdate to send a full object update to a part, (diff)
downloadopensim-SC-f06f13b59dd7261bfdcee59b546431fe47dcc635.zip
opensim-SC-f06f13b59dd7261bfdcee59b546431fe47dcc635.tar.gz
opensim-SC-f06f13b59dd7261bfdcee59b546431fe47dcc635.tar.bz2
opensim-SC-f06f13b59dd7261bfdcee59b546431fe47dcc635.tar.xz
Merge branch 'ubitworkmaster'
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs106
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs51
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs3
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs4
6 files changed, 131 insertions, 65 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index b0cb4ea..06f1301 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3838,47 +3838,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3838 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); 3838 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation));
3839 } 3839 }
3840 3840
3841 /// <summary> 3841 /* dont use this
3842 /// Requeue an EntityUpdate when it was not acknowledged by the client. 3842 udp packet resent must be done at udp level only
3843 /// We will update the priority and put it in the correct queue, merging update flags 3843 re map from a packet to original updates just doesnt work
3844 /// with any other updates that may be queued for the same entity.
3845 /// The original update time is used for the merged update.
3846 /// </summary>
3847 private void ResendPrimUpdate(EntityUpdate update)
3848 {
3849 // If the update exists in priority queue, it will be updated.
3850 // If it does not exist then it will be added with the current (rather than its original) priority
3851 uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity);
3852 3844
3853 lock (m_entityUpdates.SyncRoot) 3845 /// <summary>
3854 m_entityUpdates.Enqueue(priority, update); 3846 /// Requeue an EntityUpdate when it was not acknowledged by the client.
3855 } 3847 /// We will update the priority and put it in the correct queue, merging update flags
3848 /// with any other updates that may be queued for the same entity.
3849 /// The original update time is used for the merged update.
3850 /// </summary>
3851 private void ResendPrimUpdate(EntityUpdate update)
3852 {
3853 // If the update exists in priority queue, it will be updated.
3854 // If it does not exist then it will be added with the current (rather than its original) priority
3855 uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity);
3856 3856
3857 /// <summary> 3857 lock (m_entityUpdates.SyncRoot)
3858 /// Requeue a list of EntityUpdates when they were not acknowledged by the client. 3858 m_entityUpdates.Enqueue(priority, update);
3859 /// We will update the priority and put it in the correct queue, merging update flags 3859 }
3860 /// with any other updates that may be queued for the same entity.
3861 /// The original update time is used for the merged update.
3862 /// </summary>
3863 private void ResendPrimUpdates(List<EntityUpdate> updates, OutgoingPacket oPacket)
3864 {
3865 // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber);
3866 3860
3867 // Remove the update packet from the list of packets waiting for acknowledgement
3868 // because we are requeuing the list of updates. They will be resent in new packets
3869 // with the most recent state and priority.
3870 m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber);
3871 3861
3872 // Count this as a resent packet since we are going to requeue all of the updates contained in it 3862 /// <summary>
3873 Interlocked.Increment(ref m_udpClient.PacketsResent); 3863 /// Requeue a list of EntityUpdates when they were not acknowledged by the client.
3864 /// We will update the priority and put it in the correct queue, merging update flags
3865 /// with any other updates that may be queued for the same entity.
3866 /// The original update time is used for the merged update.
3867 /// </summary>
3868 private void ResendPrimUpdates(List<EntityUpdate> updates, OutgoingPacket oPacket)
3869 {
3870 // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber);
3874 3871
3875 // We're not going to worry about interlock yet since its not currently critical that this total count 3872 // Remove the update packet from the list of packets waiting for acknowledgement
3876 // is 100% correct 3873 // because we are requeuing the list of updates. They will be resent in new packets
3877 m_udpServer.PacketsResentCount++; 3874 // with the most recent state and priority.
3875 m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber);
3878 3876
3879 foreach (EntityUpdate update in updates) 3877 // Count this as a resent packet since we are going to requeue all of the updates contained in it
3880 ResendPrimUpdate(update); 3878 Interlocked.Increment(ref m_udpClient.PacketsResent);
3881 } 3879
3880 // We're not going to worry about interlock yet since its not currently critical that this total count
3881 // is 100% correct
3882 m_udpServer.PacketsResentCount++;
3883
3884 foreach (EntityUpdate update in updates)
3885 ResendPrimUpdate(update);
3886 }
3887 */
3882 3888
3883// OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); 3889// OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
3884// OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); 3890// OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
@@ -4197,12 +4203,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4197 for (int i = 0; i < blocks.Count; i++) 4203 for (int i = 0; i < blocks.Count; i++)
4198 packet.ObjectData[i] = blocks[i]; 4204 packet.ObjectData[i] = blocks[i];
4199 4205
4200 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); 4206// OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
4207 // use default udp retry
4208 OutPacket(packet, ThrottleOutPacketType.Task, true);
4201 } 4209 }
4202 4210
4211
4212
4203 #endregion Packet Sending 4213 #endregion Packet Sending
4214
4204 } 4215 }
4205 4216
4217 // hack.. dont use
4218 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
4219 {
4220 if (ent is SceneObjectPart)
4221 {
4222 SceneObjectPart part = (SceneObjectPart)ent;
4223 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
4224 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4225 packet.RegionData.TimeDilation = 1;
4226 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
4227
4228 ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId);
4229 if (parentID.HasValue)
4230 {
4231 blk.ParentID = parentID.Value;
4232 }
4233
4234 packet.ObjectData[0] = blk;
4235
4236 OutPacket(packet, ThrottleOutPacketType.Task, true);
4237 }
4238 }
4239
4206 public void ReprioritizeUpdates() 4240 public void ReprioritizeUpdates()
4207 { 4241 {
4208 lock (m_entityUpdates.SyncRoot) 4242 lock (m_entityUpdates.SyncRoot)
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 19d2689..c0405ad 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -175,7 +175,7 @@ namespace OpenSim.Region.Framework.Scenes
175 { 175 {
176 // Attachments are high priority, 176 // Attachments are high priority,
177 if (((SceneObjectPart)entity).ParentGroup.IsAttachment) 177 if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
178 return 1; 178 return 2;
179 179
180 pqueue = ComputeDistancePriority(client, entity, false); 180 pqueue = ComputeDistancePriority(client, entity, false);
181 181
@@ -233,16 +233,28 @@ namespace OpenSim.Region.Framework.Scenes
233 233
234 // And convert the distance to a priority queue, this computation gives queues 234 // And convert the distance to a priority queue, this computation gives queues
235 // at 10, 20, 40, 80, 160, 320, 640, and 1280m 235 // at 10, 20, 40, 80, 160, 320, 640, and 1280m
236 uint pqueue = PriorityQueue.NumberOfImmediateQueues; 236 uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue
237 uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; 237 uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues;
238 238/*
239 for (int i = 0; i < queues - 1; i++) 239 for (int i = 0; i < queues - 1; i++)
240 { 240 {
241 if (distance < 30 * Math.Pow(2.0,i)) 241 if (distance < 30 * Math.Pow(2.0,i))
242 break; 242 break;
243 pqueue++; 243 pqueue++;
244 } 244 }
245 245*/
246 if (distance > 10f)
247 {
248 float tmp = (float)Math.Log((double)distance) * 1.4426950408889634073599246810019f - 3.3219280948873623478703194294894f;
249 // for a map identical to original:
250 // now
251 // 1st constant is 1/(log(2)) (natural log) so we get log2(distance)
252 // 2st constant makes it be log2(distance/10)
253 pqueue += (uint)tmp;
254 if (pqueue > queues - 1)
255 pqueue = queues - 1;
256 }
257
246 // If this is a root agent, then determine front & back 258 // If this is a root agent, then determine front & back
247 // Bump up the priority queue (drop the priority) for any objects behind the avatar 259 // Bump up the priority queue (drop the priority) for any objects behind the avatar
248 if (useFrontBack && ! presence.IsChildAgent) 260 if (useFrontBack && ! presence.IsChildAgent)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index dd0c828..f5be7a7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -295,6 +295,18 @@ namespace OpenSim.Region.Framework.Scenes
295 295
296 return myID; 296 return myID;
297 } 297 }
298
299 public uint AllocatePresenceLocalId()
300 {
301 uint myID;
302
303 _primAllocateMutex.WaitOne();
304 myID = ++m_lastAllocatedLocalId;
305 ++m_lastAllocatedLocalId;
306 _primAllocateMutex.ReleaseMutex();
307
308 return myID;
309 }
298 310
299 #region Module Methods 311 #region Module Methods
300 312
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a0c3ba9..73283ed 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -969,7 +969,7 @@ namespace OpenSim.Region.Framework.Scenes
969 m_name = String.Format("{0} {1}", Firstname, Lastname); 969 m_name = String.Format("{0} {1}", Firstname, Lastname);
970 m_scene = world; 970 m_scene = world;
971 m_uuid = client.AgentId; 971 m_uuid = client.AgentId;
972 LocalId = m_scene.AllocateLocalId(); 972 LocalId = m_scene.AllocatePresenceLocalId();
973 973
974 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); 974 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
975 if (account != null) 975 if (account != null)
@@ -1878,7 +1878,6 @@ namespace OpenSim.Region.Framework.Scenes
1878 if (!IsChildAgent) 1878 if (!IsChildAgent)
1879 { 1879 {
1880 1880
1881
1882 ValidateAndSendAppearanceAndAgentData(); 1881 ValidateAndSendAppearanceAndAgentData();
1883 1882
1884 m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1883 m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -1900,35 +1899,31 @@ namespace OpenSim.Region.Framework.Scenes
1900 m_log.DebugFormat( 1899 m_log.DebugFormat(
1901 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); 1900 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
1902 1901
1903 List<uint> kk = new List<uint>();
1904
1905 // Resume scripts this possible should also be moved down after sending the avatar to viewer ? 1902 // Resume scripts this possible should also be moved down after sending the avatar to viewer ?
1906 foreach (SceneObjectGroup sog in m_attachments) 1903 foreach (SceneObjectGroup sog in m_attachments)
1907 { 1904 {
1908 foreach (SceneObjectPart part in sog.Parts)
1909 kk.Add(part.LocalId);
1910
1911 sog.SendFullUpdateToClient(ControllingClient); 1905 sog.SendFullUpdateToClient(ControllingClient);
1912 SendFullUpdateToClient(ControllingClient); 1906 SendFullUpdateToClient(ControllingClient);
1913 1907
1914 // sog.ScheduleGroupForFullUpdate(); 1908 if (!sog.HasPrivateAttachmentPoint)
1915 m_scene.ForEachScenePresence(delegate(ScenePresence p)
1916 { 1909 {
1917 if (p == this) 1910 // sog.ScheduleGroupForFullUpdate();
1918 return; 1911 m_scene.ForEachScenePresence(delegate(ScenePresence p)
1919 if (sog.HasPrivateAttachmentPoint) 1912 {
1920 return; 1913 if (p == this)
1921 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) 1914 return;
1922 return; 1915
1923 1916 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
1924 p.ControllingClient.SendKillObject(kk); 1917 return;
1925 sog.SendFullUpdateToClient(p.ControllingClient); 1918
1926 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path 1919 p.ControllingClient.SendPartFullUpdate(sog.RootPart,LocalId + 1);
1927 }); 1920 sog.SendFullUpdateToClient(p.ControllingClient);
1928 1921 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path
1922 });
1923 }
1924
1929 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 1925 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
1930 sog.ResumeScripts(); 1926 sog.ResumeScripts();
1931 kk.Clear();
1932 } 1927 }
1933 } 1928 }
1934 } 1929 }
@@ -4752,12 +4747,18 @@ namespace OpenSim.Region.Framework.Scenes
4752 foreach (SceneObjectGroup sog in m_attachments) 4747 foreach (SceneObjectGroup sog in m_attachments)
4753 { 4748 {
4754 if (p == this || !sog.HasPrivateAttachmentPoint) 4749 if (p == this || !sog.HasPrivateAttachmentPoint)
4750 {
4751 p.ControllingClient.SendPartFullUpdate(sog.RootPart, LocalId + 1);
4755 sog.SendFullUpdateToClient(p.ControllingClient); 4752 sog.SendFullUpdateToClient(p.ControllingClient);
4753 }
4756 } 4754 }
4757 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path 4755 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path
4758 } 4756 }
4759 } 4757 }
4760 4758
4759 // send attachments to a client without filters except for huds
4760 // for now they are checked in several places down the line...
4761 // kills all parts before sending
4761 public void SendAttachmentsToAgentNFPK(ScenePresence p) 4762 public void SendAttachmentsToAgentNFPK(ScenePresence p)
4762 { 4763 {
4763 lock (m_attachments) 4764 lock (m_attachments)
@@ -5680,7 +5681,7 @@ namespace OpenSim.Region.Framework.Scenes
5680 p.SendAppearanceToAgent(this); 5681 p.SendAppearanceToAgent(this);
5681 if (p.Animator != null) 5682 if (p.Animator != null)
5682 p.Animator.SendAnimPackToClient(ControllingClient); 5683 p.Animator.SendAnimPackToClient(ControllingClient);
5683 p.SendAttachmentsToAgentNFPK(this); 5684 p.SendAttachmentsToAgentNF(this);
5684 } 5685 }
5685 } 5686 }
5686 } 5687 }
@@ -5995,7 +5996,7 @@ namespace OpenSim.Region.Framework.Scenes
5995 SendAppearanceToAgent(p); 5996 SendAppearanceToAgent(p);
5996 if (Animator != null) 5997 if (Animator != null)
5997 Animator.SendAnimPackToClient(p.ControllingClient); 5998 Animator.SendAnimPackToClient(p.ControllingClient);
5998 SendAttachmentsToAgentNFPK(p); 5999 SendAttachmentsToAgentNF(p);
5999 } 6000 }
6000 } 6001 }
6001 6002
@@ -6011,7 +6012,7 @@ namespace OpenSim.Region.Framework.Scenes
6011 p.SendAppearanceToAgent(this); 6012 p.SendAppearanceToAgent(this);
6012 if (p.Animator != null) 6013 if (p.Animator != null)
6013 p.Animator.SendAnimPackToClient(ControllingClient); 6014 p.Animator.SendAnimPackToClient(ControllingClient);
6014 p.SendAttachmentsToAgentNFPK(this); 6015 p.SendAttachmentsToAgentNF(this);
6015 } 6016 }
6016 } 6017 }
6017 } 6018 }
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index f35ea92..2112b71 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1702,5 +1702,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1702 { 1702 {
1703 } 1703 }
1704 1704
1705 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
1706 {
1707 }
1705 } 1708 }
1706} 1709}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 7002d75..fa1d38a 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -1272,5 +1272,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1272 { 1272 {
1273 } 1273 }
1274 1274
1275 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
1276 {
1277 }
1278
1275 } 1279 }
1276} 1280}