diff options
author | MW | 2007-09-06 14:15:16 +0000 |
---|---|---|
committer | MW | 2007-09-06 14:15:16 +0000 |
commit | 804e87861b95f08590cff8a84a4b9955f1750452 (patch) | |
tree | 2a9c6fcdf1ae6236f495f8f8012ae069c1011f5f | |
parent | fixed mantis bug 375 (copy broken with physics/ODE enabled) (diff) | |
download | opensim-SC_OLD-804e87861b95f08590cff8a84a4b9955f1750452.zip opensim-SC_OLD-804e87861b95f08590cff8a84a4b9955f1750452.tar.gz opensim-SC_OLD-804e87861b95f08590cff8a84a4b9955f1750452.tar.bz2 opensim-SC_OLD-804e87861b95f08590cff8a84a4b9955f1750452.tar.xz |
added experimental method of trying to relieve missing prim problem (by adding a limit of the number of prim update packets sent in each update loop).
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 60 |
4 files changed, 123 insertions, 13 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 4e87032..4151074 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -928,13 +928,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
928 | } | 928 | } |
929 | } | 929 | } |
930 | 930 | ||
931 | public void SendAllSceneObjectsToClient(IClientAPI client) | 931 | public void SendAllSceneObjectsToClient(ScenePresence presence) |
932 | { | 932 | { |
933 | foreach (EntityBase ent in Entities.Values) | 933 | foreach (EntityBase ent in Entities.Values) |
934 | { | 934 | { |
935 | if (ent is SceneObjectGroup) | 935 | if (ent is SceneObjectGroup) |
936 | { | 936 | { |
937 | ((SceneObjectGroup)ent).SendFullUpdateToClient(client); | 937 | // ((SceneObjectGroup)ent).SendFullUpdateToClient(client); |
938 | ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); | ||
938 | } | 939 | } |
939 | } | 940 | } |
940 | } | 941 | } |
@@ -1229,6 +1230,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1229 | } | 1230 | } |
1230 | #endregion | 1231 | #endregion |
1231 | 1232 | ||
1233 | private void forceClientUpdate() | ||
1234 | { | ||
1235 | foreach (EntityBase ent in this.Entities.Values) | ||
1236 | { | ||
1237 | if (ent is SceneObjectGroup) | ||
1238 | { | ||
1239 | ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); | ||
1240 | } | ||
1241 | } | ||
1242 | } | ||
1243 | |||
1232 | public void ProcessConsoleCmd(string command, string[] cmdparams) | 1244 | public void ProcessConsoleCmd(string command, string[] cmdparams) |
1233 | { | 1245 | { |
1234 | switch (command) | 1246 | switch (command) |
@@ -1243,12 +1255,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1243 | MainLog.Instance.Error("show users - show info about connected users in the current region."); | 1255 | MainLog.Instance.Error("show users - show info about connected users in the current region."); |
1244 | MainLog.Instance.Error("shutdown - disconnect all clients and shutdown."); | 1256 | MainLog.Instance.Error("shutdown - disconnect all clients and shutdown."); |
1245 | break; | 1257 | break; |
1258 | |||
1246 | case "show": | 1259 | case "show": |
1247 | if (cmdparams.Length > 0) | 1260 | if (cmdparams.Length > 0) |
1248 | { | 1261 | { |
1249 | Show(cmdparams[0]); | 1262 | Show(cmdparams[0]); |
1250 | } | 1263 | } |
1251 | break; | 1264 | break; |
1265 | |||
1252 | case "save-xml": | 1266 | case "save-xml": |
1253 | if (cmdparams.Length > 0) | 1267 | if (cmdparams.Length > 0) |
1254 | { | 1268 | { |
@@ -1277,13 +1291,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1277 | 1291 | ||
1278 | case "force-update": | 1292 | case "force-update": |
1279 | Console.WriteLine("Updating all clients"); | 1293 | Console.WriteLine("Updating all clients"); |
1280 | foreach(EntityBase ent in this.Entities.Values) | 1294 | this.forceClientUpdate(); |
1281 | { | ||
1282 | if (ent is SceneObjectGroup) | ||
1283 | { | ||
1284 | ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); | ||
1285 | } | ||
1286 | } | ||
1287 | break; | 1295 | break; |
1288 | 1296 | ||
1289 | case "backup": | 1297 | case "backup": |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 1869a63..b202f3c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -347,6 +347,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | public void ScheduleFullUpdateToAvatar(ScenePresence presence) | ||
351 | { | ||
352 | foreach (SceneObjectPart part in this.m_parts.Values) | ||
353 | { | ||
354 | part.AddFullUpdateToAvatar(presence); | ||
355 | } | ||
356 | } | ||
357 | |||
358 | public void ScheduleTerseUpdateToAvatar(ScenePresence presence) | ||
359 | { | ||
360 | foreach (SceneObjectPart part in this.m_parts.Values) | ||
361 | { | ||
362 | part.AddTerseUpdateToAvatar(presence); | ||
363 | } | ||
364 | } | ||
365 | |||
350 | /// <summary> | 366 | /// <summary> |
351 | /// | 367 | /// |
352 | /// </summary> | 368 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 65a995a..dec017e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -391,14 +391,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
391 | { | 391 | { |
392 | if (m_updateFlag == 1) //some change has been made so update the clients | 392 | if (m_updateFlag == 1) //some change has been made so update the clients |
393 | { | 393 | { |
394 | SendTerseUpdateToAllClients(); | 394 | AddTerseUpdateToAllAvatars(); |
395 | ClearUpdateSchedule(); | 395 | ClearUpdateSchedule(); |
396 | } | 396 | } |
397 | else | 397 | else |
398 | { | 398 | { |
399 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 399 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
400 | { | 400 | { |
401 | SendFullUpdateToAllClients(); | 401 | AddFullUpdateToAllAvatars(); |
402 | ClearUpdateSchedule(); | 402 | ClearUpdateSchedule(); |
403 | } | 403 | } |
404 | } | 404 | } |
@@ -603,6 +603,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
603 | #endregion | 603 | #endregion |
604 | 604 | ||
605 | #region Client Update Methods | 605 | #region Client Update Methods |
606 | public void AddFullUpdateToAllAvatars() | ||
607 | { | ||
608 | List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); | ||
609 | for (int i = 0; i < avatars.Count; i++) | ||
610 | { | ||
611 | avatars[i].AddFullPart(this); | ||
612 | } | ||
613 | } | ||
614 | |||
615 | public void AddFullUpdateToAvatar(ScenePresence presence) | ||
616 | { | ||
617 | presence.AddFullPart(this); | ||
618 | } | ||
619 | |||
606 | /// <summary> | 620 | /// <summary> |
607 | /// | 621 | /// |
608 | /// </summary> | 622 | /// </summary> |
@@ -649,6 +663,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
649 | m_text, ParentID, this.m_particleSystem, lRot); | 663 | m_text, ParentID, this.m_particleSystem, lRot); |
650 | } | 664 | } |
651 | 665 | ||
666 | /// Terse updates | ||
667 | |||
668 | public void AddTerseUpdateToAllAvatars() | ||
669 | { | ||
670 | List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); | ||
671 | for (int i = 0; i < avatars.Count; i++) | ||
672 | { | ||
673 | avatars[i].AddTersePart(this); | ||
674 | } | ||
675 | } | ||
676 | |||
677 | public void AddTerseUpdateToAvatar(ScenePresence presence) | ||
678 | { | ||
679 | presence.AddTersePart(this); | ||
680 | } | ||
681 | |||
652 | /// <summary> | 682 | /// <summary> |
653 | /// | 683 | /// |
654 | /// </summary> | 684 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index e094ac6..285c691 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -88,6 +88,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
88 | public delegate void SignificantClientMovement(IClientAPI remote_client); | 88 | public delegate void SignificantClientMovement(IClientAPI remote_client); |
89 | public event SignificantClientMovement OnSignificantClientMovement; | 89 | public event SignificantClientMovement OnSignificantClientMovement; |
90 | 90 | ||
91 | // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>(); | ||
92 | // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>(); | ||
93 | |||
94 | private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); | ||
95 | private Queue<SceneObjectPart> m_teserPartUpdates = new Queue<SceneObjectPart>(); | ||
96 | |||
91 | #region Properties | 97 | #region Properties |
92 | /// <summary> | 98 | /// <summary> |
93 | /// | 99 | /// |
@@ -193,6 +199,54 @@ namespace OpenSim.Region.Environment.Scenes | |||
193 | } | 199 | } |
194 | #endregion | 200 | #endregion |
195 | 201 | ||
202 | public void AddTersePart(SceneObjectPart part) | ||
203 | { | ||
204 | m_teserPartUpdates.Enqueue(part); | ||
205 | } | ||
206 | |||
207 | public void AddFullPart(SceneObjectPart part) | ||
208 | { | ||
209 | m_fullPartUpdates.Enqueue(part); | ||
210 | } | ||
211 | |||
212 | public void SendPrimUpdates() | ||
213 | { | ||
214 | if (m_teserPartUpdates.Count > 0) | ||
215 | { | ||
216 | bool terse = true; | ||
217 | int terseCount = 0; | ||
218 | |||
219 | while (terse) | ||
220 | { | ||
221 | SceneObjectPart part = m_teserPartUpdates.Dequeue(); | ||
222 | part.SendTerseUpdate(this.ControllingClient); | ||
223 | terseCount++; | ||
224 | |||
225 | if ((m_teserPartUpdates.Count < 1) |(terseCount > 30)) | ||
226 | { | ||
227 | terse = false; | ||
228 | } | ||
229 | } | ||
230 | } | ||
231 | if (m_fullPartUpdates.Count > 0) | ||
232 | { | ||
233 | bool full = true; | ||
234 | int fullCount = 0; | ||
235 | |||
236 | while (full) | ||
237 | { | ||
238 | SceneObjectPart part = m_fullPartUpdates.Dequeue(); | ||
239 | part.SendFullUpdate(this.ControllingClient); | ||
240 | fullCount++; | ||
241 | if ((m_fullPartUpdates.Count < 1) | (fullCount > 40)) | ||
242 | { | ||
243 | full = false; | ||
244 | } | ||
245 | |||
246 | } | ||
247 | } | ||
248 | } | ||
249 | |||
196 | #region Status Methods | 250 | #region Status Methods |
197 | /// <summary> | 251 | /// <summary> |
198 | /// Not Used, most likely can be deleted | 252 | /// Not Used, most likely can be deleted |
@@ -221,7 +275,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
221 | this._physActor.Flying = isFlying; | 275 | this._physActor.Flying = isFlying; |
222 | this.newAvatar = true; | 276 | this.newAvatar = true; |
223 | this.childAgent = false; | 277 | this.childAgent = false; |
224 | this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); | 278 | this.m_scene.SendAllSceneObjectsToClient(this); |
225 | } | 279 | } |
226 | 280 | ||
227 | protected void MakeChildAgent() | 281 | protected void MakeChildAgent() |
@@ -399,6 +453,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
399 | /// </summary> | 453 | /// </summary> |
400 | public override void Update() | 454 | public override void Update() |
401 | { | 455 | { |
456 | this.SendPrimUpdates(); | ||
457 | |||
402 | if (this.childAgent == false) | 458 | if (this.childAgent == false) |
403 | { | 459 | { |
404 | if (this.newForce) | 460 | if (this.newForce) |
@@ -500,7 +556,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
500 | //this.SendFullUpdateToALLClients(); | 556 | //this.SendFullUpdateToALLClients(); |
501 | //this.SendArrearanceToAllOtherAgents(); | 557 | //this.SendArrearanceToAllOtherAgents(); |
502 | 558 | ||
503 | this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); | 559 | this.m_scene.SendAllSceneObjectsToClient(this); |
504 | this.ControllingClient.SendViewerTime(this.m_scene.TimePhase); | 560 | this.ControllingClient.SendViewerTime(this.m_scene.TimePhase); |
505 | 561 | ||
506 | //Please don't remove the following code (at least not yet), just leave it commented out | 562 | //Please don't remove the following code (at least not yet), just leave it commented out |