aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-05-16 15:02:23 +0100
committerMelanie2010-05-16 15:02:23 +0100
commita723225179503cf24b37471094208fd53281489c (patch)
treeff086095ff8424eb311ca73b5e8a1b069c76af87 /OpenSim
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentAdd some debug output to GetAgent to try and track down our presence problems (diff)
downloadopensim-SC-a723225179503cf24b37471094208fd53281489c.zip
opensim-SC-a723225179503cf24b37471094208fd53281489c.tar.gz
opensim-SC-a723225179503cf24b37471094208fd53281489c.tar.bz2
opensim-SC-a723225179503cf24b37471094208fd53281489c.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs56
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs2
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs8
6 files changed, 73 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 41e41e4..d9aecd8 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -909,7 +909,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
909 client.OnLogout += LogoutHandler; 909 client.OnLogout += LogoutHandler;
910 910
911 // Start the IClientAPI 911 // Start the IClientAPI
912 client.Start(); 912 // Spin it off so that it doesn't clog up the LLUDPServer
913 Util.FireAndForget(delegate(object o) { client.Start(); });
913 } 914 }
914 else 915 else
915 { 916 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 5dc9c44..5339dee 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -201,9 +201,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
201 201
202 UserFriendData data = m_Friends[principalID]; 202 UserFriendData data = m_Friends[principalID];
203 203
204 string searchFor = friendID.ToString();
204 foreach (FriendInfo fi in data.Friends) 205 foreach (FriendInfo fi in data.Friends)
205 { 206 {
206 if (fi.Friend == friendID.ToString()) 207 if (fi.Friend == searchFor)
207 return (uint)fi.TheirFlags; 208 return (uint)fi.TheirFlags;
208 } 209 }
209 return 0; 210 return 0;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f43de20..c16ba12 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -70,6 +70,9 @@ namespace OpenSim.Region.Framework.Scenes
70 70
71 protected Dictionary<UUID, ScenePresence> m_scenePresences = new Dictionary<UUID, ScenePresence>(); 71 protected Dictionary<UUID, ScenePresence> m_scenePresences = new Dictionary<UUID, ScenePresence>();
72 protected ScenePresence[] m_scenePresenceArray = new ScenePresence[0]; 72 protected ScenePresence[] m_scenePresenceArray = new ScenePresence[0];
73 protected List<ScenePresence> m_scenePresenceList = new List<ScenePresence>();
74
75 protected OpenMetaverse.ReaderWriterLockSlim m_scenePresencesLock = new OpenMetaverse.ReaderWriterLockSlim();
73 76
74 // SceneObjects is not currently populated or used. 77 // SceneObjects is not currently populated or used.
75 //public Dictionary<UUID, SceneObjectGroup> SceneObjects; 78 //public Dictionary<UUID, SceneObjectGroup> SceneObjects;
@@ -132,10 +135,16 @@ namespace OpenSim.Region.Framework.Scenes
132 135
133 protected internal void Close() 136 protected internal void Close()
134 { 137 {
135 lock (m_scenePresences) 138 m_scenePresencesLock.EnterWriteLock();
139 try
136 { 140 {
137 m_scenePresences.Clear(); 141 m_scenePresences.Clear();
138 m_scenePresenceArray = new ScenePresence[0]; 142 m_scenePresenceArray = new ScenePresence[0];
143 m_scenePresenceList = new List<ScenePresence>();
144 }
145 finally
146 {
147 m_scenePresencesLock.ExitWriteLock();
139 } 148 }
140 149
141 lock (m_dictionary_lock) 150 lock (m_dictionary_lock)
@@ -542,7 +551,8 @@ namespace OpenSim.Region.Framework.Scenes
542 551
543 Entities[presence.UUID] = presence; 552 Entities[presence.UUID] = presence;
544 553
545 lock (m_scenePresences) 554 m_scenePresencesLock.EnterWriteLock();
555 try
546 { 556 {
547 if (!m_scenePresences.ContainsKey(presence.UUID)) 557 if (!m_scenePresences.ContainsKey(presence.UUID))
548 { 558 {
@@ -554,11 +564,12 @@ namespace OpenSim.Region.Framework.Scenes
554 Array.Copy(m_scenePresenceArray, newArray, oldLength); 564 Array.Copy(m_scenePresenceArray, newArray, oldLength);
555 newArray[oldLength] = presence; 565 newArray[oldLength] = presence;
556 m_scenePresenceArray = newArray; 566 m_scenePresenceArray = newArray;
567 m_scenePresenceList = new List<ScenePresence>(m_scenePresenceArray);
557 } 568 }
558 else 569 else
559 { 570 {
560 m_scenePresences[presence.UUID] = presence; 571 m_scenePresences[presence.UUID] = presence;
561 572
562 // Do a linear search through the array of ScenePresence references 573 // Do a linear search through the array of ScenePresence references
563 // and update the modified entry 574 // and update the modified entry
564 for (int i = 0; i < m_scenePresenceArray.Length; i++) 575 for (int i = 0; i < m_scenePresenceArray.Length; i++)
@@ -569,8 +580,13 @@ namespace OpenSim.Region.Framework.Scenes
569 break; 580 break;
570 } 581 }
571 } 582 }
583 m_scenePresenceList = new List<ScenePresence>(m_scenePresenceArray);
572 } 584 }
573 } 585 }
586 finally
587 {
588 m_scenePresencesLock.ExitWriteLock();
589 }
574 } 590 }
575 591
576 /// <summary> 592 /// <summary>
@@ -585,7 +601,8 @@ namespace OpenSim.Region.Framework.Scenes
585 agentID); 601 agentID);
586 } 602 }
587 603
588 lock (m_scenePresences) 604 m_scenePresencesLock.EnterWriteLock();
605 try
589 { 606 {
590 if (m_scenePresences.Remove(agentID)) 607 if (m_scenePresences.Remove(agentID))
591 { 608 {
@@ -604,12 +621,17 @@ namespace OpenSim.Region.Framework.Scenes
604 } 621 }
605 } 622 }
606 m_scenePresenceArray = newArray; 623 m_scenePresenceArray = newArray;
624 m_scenePresenceList = new List<ScenePresence>(m_scenePresenceArray);
607 } 625 }
608 else 626 else
609 { 627 {
610 m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); 628 m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
611 } 629 }
612 } 630 }
631 finally
632 {
633 m_scenePresencesLock.ExitWriteLock();
634 }
613 } 635 }
614 636
615 protected internal void SwapRootChildAgent(bool direction_RC_CR_T_F) 637 protected internal void SwapRootChildAgent(bool direction_RC_CR_T_F)
@@ -730,8 +752,15 @@ namespace OpenSim.Region.Framework.Scenes
730 /// <returns></returns> 752 /// <returns></returns>
731 private List<ScenePresence> GetScenePresences() 753 private List<ScenePresence> GetScenePresences()
732 { 754 {
733 lock (m_scenePresences) 755 m_scenePresencesLock.EnterReadLock();
734 return new List<ScenePresence>(m_scenePresenceArray); 756 try
757 {
758 return m_scenePresenceList;
759 }
760 finally
761 {
762 m_scenePresencesLock.ExitReadLock();
763 }
735 } 764 }
736 765
737 /// <summary> 766 /// <summary>
@@ -742,10 +771,15 @@ namespace OpenSim.Region.Framework.Scenes
742 protected internal ScenePresence GetScenePresence(UUID agentID) 771 protected internal ScenePresence GetScenePresence(UUID agentID)
743 { 772 {
744 ScenePresence sp; 773 ScenePresence sp;
745 lock (m_scenePresences) 774 m_scenePresencesLock.EnterReadLock();
775 try
746 { 776 {
747 m_scenePresences.TryGetValue(agentID, out sp); 777 m_scenePresences.TryGetValue(agentID, out sp);
748 } 778 }
779 finally
780 {
781 m_scenePresencesLock.ExitReadLock();
782 }
749 return sp; 783 return sp;
750 } 784 }
751 785
@@ -780,10 +814,15 @@ namespace OpenSim.Region.Framework.Scenes
780 814
781 protected internal bool TryGetScenePresence(UUID agentID, out ScenePresence avatar) 815 protected internal bool TryGetScenePresence(UUID agentID, out ScenePresence avatar)
782 { 816 {
783 lock (m_scenePresences) 817 m_scenePresencesLock.EnterReadLock();
818 try
784 { 819 {
785 m_scenePresences.TryGetValue(agentID, out avatar); 820 m_scenePresences.TryGetValue(agentID, out avatar);
786 } 821 }
822 finally
823 {
824 m_scenePresencesLock.ExitReadLock();
825 }
787 return (avatar != null); 826 return (avatar != null);
788 } 827 }
789 828
@@ -1061,6 +1100,7 @@ namespace OpenSim.Region.Framework.Scenes
1061 Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction); 1100 Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction);
1062 */ 1101 */
1063 // For now, perform actiona serially 1102 // For now, perform actiona serially
1103
1064 foreach (ScenePresence sp in GetScenePresences()) 1104 foreach (ScenePresence sp in GetScenePresences())
1065 { 1105 {
1066 try 1106 try
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 35134d6..a4b8944 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3651,7 +3651,8 @@ namespace OpenSim.Region.Framework.Scenes
3651 if (atRotTargets.Count > 0) 3651 if (atRotTargets.Count > 0)
3652 { 3652 {
3653 uint[] localids = new uint[0]; 3653 uint[] localids = new uint[0];
3654 lock (m_parts) 3654 lockPartsForRead(true);
3655 try
3655 { 3656 {
3656 localids = new uint[m_parts.Count]; 3657 localids = new uint[m_parts.Count];
3657 int cntr = 0; 3658 int cntr = 0;
@@ -3661,6 +3662,10 @@ namespace OpenSim.Region.Framework.Scenes
3661 cntr++; 3662 cntr++;
3662 } 3663 }
3663 } 3664 }
3665 finally
3666 {
3667 lockPartsForRead(false);
3668 }
3664 3669
3665 for (int ctr = 0; ctr < localids.Length; ctr++) 3670 for (int ctr = 0; ctr < localids.Length; ctr++)
3666 { 3671 {
@@ -3679,7 +3684,8 @@ namespace OpenSim.Region.Framework.Scenes
3679 { 3684 {
3680 //trigger not_at_target 3685 //trigger not_at_target
3681 uint[] localids = new uint[0]; 3686 uint[] localids = new uint[0];
3682 lock (m_parts) 3687 lockPartsForRead(true);
3688 try
3683 { 3689 {
3684 localids = new uint[m_parts.Count]; 3690 localids = new uint[m_parts.Count];
3685 int cntr = 0; 3691 int cntr = 0;
@@ -3689,6 +3695,10 @@ namespace OpenSim.Region.Framework.Scenes
3689 cntr++; 3695 cntr++;
3690 } 3696 }
3691 } 3697 }
3698 finally
3699 {
3700 lockPartsForRead(false);
3701 }
3692 3702
3693 for (int ctr = 0; ctr < localids.Length; ctr++) 3703 for (int ctr = 0; ctr < localids.Length; ctr++)
3694 { 3704 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 62b44bd..c4cff12 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -840,12 +840,12 @@ namespace OpenSim.Region.Framework.Scenes
840 } 840 }
841 else 841 else
842 { 842 {
843 m_items.LockItemsForRead(false);
843 m_log.ErrorFormat( 844 m_log.ErrorFormat(
844 "[PRIM INVENTORY]: " + 845 "[PRIM INVENTORY]: " +
845 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory", 846 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
846 itemID, m_part.Name, m_part.UUID); 847 itemID, m_part.Name, m_part.UUID);
847 } 848 }
848 m_items.LockItemsForWrite(false);
849 849
850 return -1; 850 return -1;
851 } 851 }
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
index 41ebeaf..9f86078 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
@@ -300,6 +300,14 @@ namespace OpenSim.Services.Connectors
300 { 300 {
301 pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); 301 pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]);
302 } 302 }
303 else
304 {
305 m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for sessionID {0}", sessionID.ToString());
306 }
307 }
308 else
309 {
310 m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply received from presence server when querying for sessionID {0}", sessionID.ToString());
303 } 311 }
304 312
305 return pinfo; 313 return pinfo;