aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs23
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs78
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs4
5 files changed, 43 insertions, 72 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index d85eda0..57f5e76 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -85,8 +85,12 @@ namespace OpenSim.Framework.Communications.Cache
85 /// </summary> 85 /// </summary>
86 private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders 86 private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
87 = new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); 87 = new Dictionary<LLUUID, IList<InventoryFolderImpl>>();
88 88
89 public LLUUID SessionID { get { return m_session_id; } } 89 public LLUUID SessionID
90 {
91 get { return m_session_id; }
92 set { m_session_id = value; }
93 }
90 private LLUUID m_session_id = LLUUID.Zero; 94 private LLUUID m_session_id = LLUUID.Zero;
91 95
92 /// <summary> 96 /// <summary>
@@ -101,21 +105,6 @@ namespace OpenSim.Framework.Communications.Cache
101 } 105 }
102 106
103 /// <summary> 107 /// <summary>
104 /// Constructor
105 /// </summary>
106 /// <param name="commsManager"></param>
107 /// <param name="userProfile"></param>
108 /// <param name="sessionId">
109 /// Session id of the user. This is used in subsequent security checks.
110 /// </param>
111 public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile, LLUUID sessionId)
112 {
113 m_commsManager = commsManager;
114 m_userProfile = userProfile;
115 m_session_id = sessionId;
116 }
117
118 /// <summary>
119 /// This allows a request to be added to be processed once we receive a user's inventory 108 /// This allows a request to be added to be processed once we receive a user's inventory
120 /// from the inventory service. If we already have the inventory, the request 109 /// from the inventory service. If we already have the inventory, the request
121 /// is executed immediately instead. 110 /// is executed immediately instead.
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index c4a6b31..db58738 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -63,58 +63,10 @@ namespace OpenSim.Framework.Communications.Cache
63 /// A new user has moved into a region in this instance so retrieve their profile from the user service. 63 /// A new user has moved into a region in this instance so retrieve their profile from the user service.
64 /// </summary> 64 /// </summary>
65 /// <param name="userID"></param> 65 /// <param name="userID"></param>
66 public void AddNewUser(IClientAPI remoteClient)
67 {
68 m_log.DebugFormat("[USER CACHE]: Adding user profile for {0} {1}", remoteClient.Name, remoteClient.AgentId);
69
70 // Potential fix - Multithreading issue.
71 lock (m_userProfiles)
72 {
73 if (!m_userProfiles.ContainsKey(remoteClient.AgentId))
74 {
75 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(remoteClient.AgentId);
76 CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userProfile, remoteClient.SessionId);
77
78 if (userInfo.UserProfile != null)
79 {
80 // The inventory for the user will be populated when they actually enter the scene
81 m_userProfiles.Add(remoteClient.AgentId, userInfo);
82 }
83 else
84 {
85 m_log.ErrorFormat("[USER CACHE]: User profile for user {0} not found.", remoteClient.AgentId);
86 }
87 }
88 }
89 }
90
91 /// <summary>
92 /// A new user has moved into a region in this instance so retrieve their profile from the user service.
93 /// </summary>
94 /// <param name="userID"></param>
95 public void AddNewUser(LLUUID userID) 66 public void AddNewUser(LLUUID userID)
96 { 67 {
97 m_log.DebugFormat("[USER CACHE]: Adding user profile for {0}", userID); 68 m_log.DebugFormat("[USER CACHE]: Adding user profile for {0}", userID);
98 69 GetUserDetails(userID);
99 // Potential fix - Multithreading issue.
100 lock (m_userProfiles)
101 {
102 if (!m_userProfiles.ContainsKey(userID))
103 {
104 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
105 CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userProfile);
106
107 if (userInfo.UserProfile != null)
108 {
109 // The inventory for the user will be populated when they actually enter the scene
110 m_userProfiles.Add(userID, userInfo);
111 }
112 else
113 {
114 m_log.ErrorFormat("[USER CACHE]: User profile for user {0} not found.", userID);
115 }
116 }
117 }
118 } 70 }
119 71
120 /// <summary> 72 /// <summary>
@@ -176,10 +128,28 @@ namespace OpenSim.Framework.Communications.Cache
176 /// <returns>null if no user details are found</returns> 128 /// <returns>null if no user details are found</returns>
177 public CachedUserInfo GetUserDetails(LLUUID userID) 129 public CachedUserInfo GetUserDetails(LLUUID userID)
178 { 130 {
179 if (m_userProfiles.ContainsKey(userID)) 131 lock (m_userProfiles)
180 return m_userProfiles[userID]; 132 {
181 else 133 if (m_userProfiles.ContainsKey(userID))
182 return null; 134 {
135 return m_userProfiles[userID];
136 }
137 else
138 {
139 UserProfileData userprofile = m_commsManager.UserService.GetUserProfile(userID);
140 if (userprofile != null)
141 {
142 CachedUserInfo userinfo = new CachedUserInfo(m_commsManager, userprofile);
143 m_userProfiles.Add(userID, userinfo);
144 return userinfo;
145 }
146 else
147 {
148 m_log.ErrorFormat("[USER CACHE]: User profile for user {0} not found.", userID);
149 return null;
150 }
151 }
152 }
183 } 153 }
184 154
185 /// <summary> 155 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f39a0e6..b54713f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2015,7 +2015,7 @@ namespace OpenSim.Region.Environment.Scenes
2015 "[SCENE]: Adding new {0} agent {1} {2} in {3}", 2015 "[SCENE]: Adding new {0} agent {1} {2} in {3}",
2016 (child ? "child" : "root"), client.Name, client.AgentId, RegionInfo.RegionName); 2016 (child ? "child" : "root"), client.Name, client.AgentId, RegionInfo.RegionName);
2017 2017
2018 CommsManager.UserProfileCacheService.AddNewUser(client); 2018 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
2019 2019
2020 CreateAndAddScenePresence(client, child); 2020 CreateAndAddScenePresence(client, child);
2021 } 2021 }
@@ -2455,6 +2455,9 @@ namespace OpenSim.Region.Environment.Scenes
2455 agent.circuitcode, agent.AgentID, RegionInfo.RegionName); 2455 agent.circuitcode, agent.AgentID, RegionInfo.RegionName);
2456 2456
2457 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 2457 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
2458 // rewrite session_id
2459 CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID);
2460 userinfo.SessionID = agent.SessionID;
2458 } 2461 }
2459 else 2462 else
2460 { 2463 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index cb37faf..348b643 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -627,6 +627,11 @@ namespace OpenSim.Region.Environment.Scenes
627 { 627 {
628 SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList()); 628 SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList());
629 } 629 }
630 // if (teleport success) // seems to be always success here
631 // the user may change thier profile information in other region,
632 // so the userinfo in UserProfileCache is not reliable any more, delete it
633 m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID);
634 m_log.InfoFormat("User {0} is going to another region, profile cache removed", avatar.UUID);
630 } 635 }
631 else 636 else
632 { 637 {
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 1721acb..5c90bf3 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -1989,6 +1989,10 @@ namespace OpenSim.Region.Environment.Scenes
1989 1989
1990 m_scene.SendKillObject(m_localId); 1990 m_scene.SendKillObject(m_localId);
1991 m_scene.NotifyMyCoarseLocationChange(); 1991 m_scene.NotifyMyCoarseLocationChange();
1992 // the user may change thier profile information in other region,
1993 // so the userinfo in UserProfileCache is not reliable any more, delete it
1994 m_scene.CommsManager.UserProfileCacheService.RemoveUser(UUID);
1995 m_log.InfoFormat("User {0} is going to another region, profile cache removed", UUID);
1992 } 1996 }
1993 else 1997 else
1994 { 1998 {