* Added a mutex to the LoginService allowing only a single login simultaneously. (queues)

* This is a temporary fix to prevent an issue with adjohn reported when attempting to login large numbers of users in a short period of time.
* A rewritten login service is on the cards.
afrisby
Adam Frisby 2007-11-09 01:59:18 +00:00
parent b01e309414
commit c93f7188c7
1 changed files with 96 additions and 85 deletions

View File

@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Threading;
using libsecondlife;
using Nwc.XmlRpc;
using OpenSim.Framework.Console;
@ -38,6 +39,7 @@ namespace OpenSim.Framework.UserManagement
{
protected string m_welcomeMessage = "Welcome to OpenSim";
protected UserManagerBase m_userManager = null;
protected Mutex m_loginMutex = new Mutex(false);
public LoginService(UserManagerBase userManager, string welcomeMess)
{
@ -54,10 +56,14 @@ namespace OpenSim.Framework.UserManagement
/// <param name="request">The XMLRPC request</param>
/// <returns>The response to send</returns>
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
{
// Temporary fix
m_loginMutex.WaitOne();
try
{
MainLog.Instance.Verbose("LOGIN", "Attempting login now...");
XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0];
Hashtable requestData = (Hashtable)request.Params[0];
bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") &&
requestData.Contains("passwd"));
@ -68,9 +74,9 @@ namespace OpenSim.Framework.UserManagement
if (GoodXML)
{
string firstname = (string) requestData["first"];
string lastname = (string) requestData["last"];
string passwd = (string) requestData["passwd"];
string firstname = (string)requestData["first"];
string lastname = (string)requestData["last"];
string passwd = (string)requestData["passwd"];
userProfile = GetTheUser(firstname, lastname);
if (userProfile == null)
@ -114,7 +120,7 @@ namespace OpenSim.Framework.UserManagement
userProfile.rootInventoryFolderID = inventData.RootFolderID;
// Circuit Code
uint circode = (uint) (Util.RandomClass.Next());
uint circode = (uint)(Util.RandomClass.Next());
logResponse.Lastname = userProfile.surname;
logResponse.Firstname = userProfile.username;
@ -125,7 +131,7 @@ namespace OpenSim.Framework.UserManagement
logResponse.InventorySkeleton = AgentInventoryArray;
logResponse.InventoryLibrary = GetInventoryLibrary();
logResponse.InventoryLibraryOwner = GetLibraryOwner();
logResponse.CircuitCode = (Int32) circode;
logResponse.CircuitCode = (Int32)circode;
//logResponse.RegionX = 0; //overwritten
//logResponse.RegionY = 0; //overwritten
logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
@ -154,6 +160,11 @@ namespace OpenSim.Framework.UserManagement
}
//}
}
}
finally
{
m_loginMutex.ReleaseMutex();
}
return response;
}