* 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;
using System.Collections; using System.Collections;
using System.Threading;
using libsecondlife; using libsecondlife;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
@ -38,6 +39,7 @@ namespace OpenSim.Framework.UserManagement
{ {
protected string m_welcomeMessage = "Welcome to OpenSim"; protected string m_welcomeMessage = "Welcome to OpenSim";
protected UserManagerBase m_userManager = null; protected UserManagerBase m_userManager = null;
protected Mutex m_loginMutex = new Mutex(false);
public LoginService(UserManagerBase userManager, string welcomeMess) public LoginService(UserManagerBase userManager, string welcomeMess)
{ {
@ -54,6 +56,10 @@ namespace OpenSim.Framework.UserManagement
/// <param name="request">The XMLRPC request</param> /// <param name="request">The XMLRPC request</param>
/// <returns>The response to send</returns> /// <returns>The response to send</returns>
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
{
// Temporary fix
m_loginMutex.WaitOne();
try
{ {
MainLog.Instance.Verbose("LOGIN", "Attempting login now..."); MainLog.Instance.Verbose("LOGIN", "Attempting login now...");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
@ -154,6 +160,11 @@ namespace OpenSim.Framework.UserManagement
} }
//} //}
} }
}
finally
{
m_loginMutex.ReleaseMutex();
}
return response; return response;
} }