stop some requests processing when module as no scenes (there must be a better way to fix this)

LSLKeyTest
UbitUmarov 2015-11-27 14:39:11 +00:00
parent bb0db96256
commit f1bbc4d386
1 changed files with 17 additions and 0 deletions

View File

@ -182,6 +182,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
// m_log.DebugFormat( // m_log.DebugFormat(
// "[USER MANAGEMENT MODULE]: Handling request for name binding of UUID {0} from {1}", // "[USER MANAGEMENT MODULE]: Handling request for name binding of UUID {0} from {1}",
// uuid, remote_client.Name); // uuid, remote_client.Name);
if(m_Scenes.Count <= 0)
return;
if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid)) if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid))
{ {
@ -288,6 +290,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public List<UserData> GetUserData(string query, int page_size, int page_number) public List<UserData> GetUserData(string query, int page_size, int page_number)
{ {
if(m_Scenes.Count <= 0)
return new List<UserData>();;
// search the user accounts service // search the user accounts service
List<UserAccount> accs = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, query); List<UserAccount> accs = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, query);
@ -380,6 +385,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
/// <param name='names'>The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User"</param> /// <param name='names'>The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User"</param>
private bool TryGetUserNamesFromServices(UUID uuid, string[] names) private bool TryGetUserNamesFromServices(UUID uuid, string[] names)
{ {
if(m_Scenes.Count <= 0)
return false;
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid); UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid);
if (account != null) if (account != null)
@ -445,6 +453,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public UUID GetUserIdByName(string firstName, string lastName) public UUID GetUserIdByName(string firstName, string lastName)
{ {
if(m_Scenes.Count <= 0)
return UUID.Zero;
// TODO: Optimize for reverse lookup if this gets used by non-console commands. // TODO: Optimize for reverse lookup if this gets used by non-console commands.
lock (m_UserCache) lock (m_UserCache)
{ {
@ -555,6 +566,12 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
#region Cache Management #region Cache Management
public bool GetUser(UUID uuid, out UserData userdata) public bool GetUser(UUID uuid, out UserData userdata)
{ {
if(m_Scenes.Count <= 0)
{
userdata = new UserData();
return false;
}
lock (m_UserCache) lock (m_UserCache)
{ {
if (m_UserCache.TryGetValue(uuid, out userdata)) if (m_UserCache.TryGetValue(uuid, out userdata))