diff options
author | John Hurliman | 2009-10-06 15:54:00 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-06 15:54:00 -0700 |
commit | 832cc685138b2244529f10b54b373c34adb4a633 (patch) | |
tree | 888cf05d2d0bacdd8acec47150075423d07ed3ee /OpenSim/Framework | |
parent | Checks the number of ThreadPool and IOCP threads on startup and bumps up the ... (diff) | |
parent | Rewrote parts of the code that were double-locking different objects. This is... (diff) | |
download | opensim-SC_OLD-832cc685138b2244529f10b54b373c34adb4a633.zip opensim-SC_OLD-832cc685138b2244529f10b54b373c34adb4a633.tar.gz opensim-SC_OLD-832cc685138b2244529f10b54b373c34adb4a633.tar.bz2 opensim-SC_OLD-832cc685138b2244529f10b54b373c34adb4a633.tar.xz |
Merging in diva's locking fixes
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | 66 | ||||
-rw-r--r-- | OpenSim/Framework/ConfigSettings.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/InventoryConfig.cs | 6 |
3 files changed, 32 insertions, 44 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 9e12d948..b02cf5b 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -128,24 +128,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
128 | /// <returns>null if no user details are found</returns> | 128 | /// <returns>null if no user details are found</returns> |
129 | public CachedUserInfo GetUserDetails(string fname, string lname) | 129 | public CachedUserInfo GetUserDetails(string fname, string lname) |
130 | { | 130 | { |
131 | CachedUserInfo userInfo; | ||
131 | lock (m_userProfilesByName) | 132 | lock (m_userProfilesByName) |
132 | { | 133 | { |
133 | CachedUserInfo userInfo; | ||
134 | |||
135 | if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo)) | 134 | if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo)) |
136 | { | ||
137 | return userInfo; | 135 | return userInfo; |
138 | } | ||
139 | else | ||
140 | { | ||
141 | UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname); | ||
142 | |||
143 | if (userProfile != null) | ||
144 | return AddToCaches(userProfile); | ||
145 | else | ||
146 | return null; | ||
147 | } | ||
148 | } | 136 | } |
137 | UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname); | ||
138 | |||
139 | if (userProfile != null) | ||
140 | return AddToCaches(userProfile); | ||
141 | else | ||
142 | return null; | ||
149 | } | 143 | } |
150 | 144 | ||
151 | /// <summary> | 145 | /// <summary> |
@@ -160,20 +154,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
160 | return null; | 154 | return null; |
161 | 155 | ||
162 | lock (m_userProfilesById) | 156 | lock (m_userProfilesById) |
163 | { | ||
164 | if (m_userProfilesById.ContainsKey(userID)) | 157 | if (m_userProfilesById.ContainsKey(userID)) |
165 | { | ||
166 | return m_userProfilesById[userID]; | 158 | return m_userProfilesById[userID]; |
167 | } | 159 | |
168 | else | 160 | UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID); |
169 | { | 161 | if (userProfile != null) |
170 | UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID); | 162 | return AddToCaches(userProfile); |
171 | if (userProfile != null) | 163 | else |
172 | return AddToCaches(userProfile); | 164 | return null; |
173 | else | ||
174 | return null; | ||
175 | } | ||
176 | } | ||
177 | } | 165 | } |
178 | 166 | ||
179 | /// <summary> | 167 | /// <summary> |
@@ -211,14 +199,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
211 | CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile); | 199 | CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile); |
212 | 200 | ||
213 | lock (m_userProfilesById) | 201 | lock (m_userProfilesById) |
214 | { | ||
215 | m_userProfilesById[createdUserInfo.UserProfile.ID] = createdUserInfo; | 202 | m_userProfilesById[createdUserInfo.UserProfile.ID] = createdUserInfo; |
216 | 203 | ||
217 | lock (m_userProfilesByName) | 204 | lock (m_userProfilesByName) |
218 | { | 205 | m_userProfilesByName[createdUserInfo.UserProfile.Name] = createdUserInfo; |
219 | m_userProfilesByName[createdUserInfo.UserProfile.Name] = createdUserInfo; | ||
220 | } | ||
221 | } | ||
222 | 206 | ||
223 | return createdUserInfo; | 207 | return createdUserInfo; |
224 | } | 208 | } |
@@ -230,21 +214,25 @@ namespace OpenSim.Framework.Communications.Cache | |||
230 | /// <returns>true if there was a profile to remove, false otherwise</returns> | 214 | /// <returns>true if there was a profile to remove, false otherwise</returns> |
231 | protected bool RemoveFromCaches(UUID userId) | 215 | protected bool RemoveFromCaches(UUID userId) |
232 | { | 216 | { |
217 | CachedUserInfo userInfo = null; | ||
233 | lock (m_userProfilesById) | 218 | lock (m_userProfilesById) |
234 | { | 219 | { |
235 | if (m_userProfilesById.ContainsKey(userId)) | 220 | if (m_userProfilesById.ContainsKey(userId)) |
236 | { | 221 | { |
237 | CachedUserInfo userInfo = m_userProfilesById[userId]; | 222 | userInfo = m_userProfilesById[userId]; |
238 | m_userProfilesById.Remove(userId); | 223 | m_userProfilesById.Remove(userId); |
239 | 224 | } | |
240 | lock (m_userProfilesByName) | 225 | } |
226 | |||
227 | if (userInfo != null) | ||
228 | lock (m_userProfilesByName) | ||
229 | { | ||
230 | if (m_userProfilesByName.ContainsKey(userInfo.UserProfile.Name)) | ||
241 | { | 231 | { |
242 | m_userProfilesByName.Remove(userInfo.UserProfile.Name); | 232 | m_userProfilesByName.Remove(userInfo.UserProfile.Name); |
233 | return true; | ||
243 | } | 234 | } |
244 | |||
245 | return true; | ||
246 | } | 235 | } |
247 | } | ||
248 | 236 | ||
249 | return false; | 237 | return false; |
250 | } | 238 | } |
diff --git a/OpenSim/Framework/ConfigSettings.cs b/OpenSim/Framework/ConfigSettings.cs index 93efffa..32415e0 100644 --- a/OpenSim/Framework/ConfigSettings.cs +++ b/OpenSim/Framework/ConfigSettings.cs | |||
@@ -168,7 +168,7 @@ namespace OpenSim.Framework | |||
168 | public const bool DefaultUserServerHttpSSL = false; | 168 | public const bool DefaultUserServerHttpSSL = false; |
169 | public const uint DefaultMessageServerHttpPort = 8006; | 169 | public const uint DefaultMessageServerHttpPort = 8006; |
170 | public const bool DefaultMessageServerHttpSSL = false; | 170 | public const bool DefaultMessageServerHttpSSL = false; |
171 | public const uint DefaultGridServerHttpPort = 8001; | 171 | public const uint DefaultGridServerHttpPort = 8003; |
172 | public const uint DefaultInventoryServerHttpPort = 8004; | 172 | public const uint DefaultInventoryServerHttpPort = 8003; |
173 | } | 173 | } |
174 | } | 174 | } |
diff --git a/OpenSim/Framework/InventoryConfig.cs b/OpenSim/Framework/InventoryConfig.cs index f539d55..dd207ad 100644 --- a/OpenSim/Framework/InventoryConfig.cs +++ b/OpenSim/Framework/InventoryConfig.cs | |||
@@ -56,15 +56,15 @@ namespace OpenSim.Framework | |||
56 | m_configMember.addConfigurationOption("default_inventory_server", | 56 | m_configMember.addConfigurationOption("default_inventory_server", |
57 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | 57 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
58 | "Default Inventory Server URI (this server's external name)", | 58 | "Default Inventory Server URI (this server's external name)", |
59 | "http://127.0.0.1:8004", false); | 59 | "http://127.0.0.1:" + ConfigSettings.DefaultInventoryServerHttpPort, false); |
60 | m_configMember.addConfigurationOption("default_user_server", | 60 | m_configMember.addConfigurationOption("default_user_server", |
61 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | 61 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
62 | "Default User Server URI", | 62 | "Default User Server URI", |
63 | "http://127.0.0.1:8002", false); | 63 | "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort, false); |
64 | m_configMember.addConfigurationOption("default_asset_server", | 64 | m_configMember.addConfigurationOption("default_asset_server", |
65 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | 65 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
66 | "Default Asset Server URI", | 66 | "Default Asset Server URI", |
67 | "http://127.0.0.1:8003", false); | 67 | "http://127.0.0.1:" + ConfigSettings.DefaultAssetServerHttpPort, false); |
68 | m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | 68 | m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |
69 | "DLL for database provider", "OpenSim.Data.MySQL.dll", false); | 69 | "DLL for database provider", "OpenSim.Data.MySQL.dll", false); |
70 | m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | 70 | m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |