* Removed some more fields from CommunicationsLocal

* added OnLoginToRegion to CommunicationsLocal
afrisby
lbsa71 2007-09-24 23:58:43 +00:00
parent 4e01aa4879
commit 3ac43d0120
5 changed files with 196 additions and 208 deletions

View File

@ -39,42 +39,25 @@ namespace OpenSim.Region.Communications.Local
{
public class CommunicationsLocal : CommunicationsManager
{
public LocalBackEndServices InstanceServices;
public LocalLoginService LoginServices;
protected LocalSettings m_settings;
protected CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache)
: base(serversInfo, httpServer, assetCache)
{
}
public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, LocalSettings settings)
: base(serversInfo, httpServer, assetCache)
{
m_settings = settings;
LocalInventoryService inventoryService = new LocalInventoryService();
inventoryService.AddPlugin(m_settings.InventoryPlugin);
inventoryService.AddPlugin(settings.InventoryPlugin);
m_inventoryService = inventoryService;
LocalUserServices userService = new LocalUserServices(this, serversInfo);
userService.AddPlugin(m_settings.UserDatabasePlugin);
userService.AddPlugin(settings.UserDatabasePlugin);
m_userService = userService;
InstanceServices = new LocalBackEndServices();
m_gridService = InstanceServices;
m_interRegion = InstanceServices;
LocalBackEndServices backendService = new LocalBackEndServices();
m_gridService = backendService;
m_interRegion = backendService;
LoginServices = new LocalLoginService(userService, m_settings.WelcomeMessage, this, serversInfo, m_settings.AccountAuthentication);
httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod);
}
LocalLoginService loginService = new LocalLoginService(userService, settings.WelcomeMessage, this, serversInfo, settings.AccountAuthentication);
loginService.OnLoginToRegion += backendService.AddNewSession;
internal void InformRegionOfLogin(ulong regionHandle, Login login)
{
this.InstanceServices.AddNewSession(regionHandle, login);
httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
}
public void doCreate(string[] cmmdParams)

View File

@ -187,7 +187,7 @@ namespace OpenSim.Region.Communications.Local
/// <param name="regionHandle"></param>
/// <param name="loginData"></param>
/// <returns></returns>
public bool AddNewSession(ulong regionHandle, Login loginData)
public void AddNewSession(ulong regionHandle, Login loginData)
{
AgentCircuitData agent = new AgentCircuitData();
agent.AgentID = loginData.Agent;
@ -204,11 +204,7 @@ namespace OpenSim.Region.Communications.Local
if (this.regionHosts.ContainsKey(regionHandle))
{
this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent);
return true;
}
// region not found
return false;
}
}
}

View File

@ -11,6 +11,8 @@ using OpenSim.Framework.Inventory;
namespace OpenSim.Region.Communications.Local
{
public delegate void LoginToRegionEvent(ulong regionHandle, Login login);
public class LocalLoginService : LoginService
{
private CommunicationsLocal m_Parent;
@ -20,6 +22,8 @@ namespace OpenSim.Region.Communications.Local
private uint defaultHomeY;
private bool authUsers = false;
public event LoginToRegionEvent OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
: base(userManager, welcomeMess)
{
@ -108,7 +112,10 @@ namespace OpenSim.Region.Communications.Local
_login.CircuitCode = (uint)response.CircuitCode;
_login.CapsPath = capsPath;
m_Parent.InformRegionOfLogin(currentRegion, _login);
if( OnLoginToRegion != null )
{
OnLoginToRegion(currentRegion, _login);
}
}
else
{

View File

@ -70,7 +70,7 @@ namespace OpenSim.Region.Communications.OGS1
// Send Request
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000);
Hashtable GridRespData = (Hashtable)GridResp.Value;
Hashtable griddatahash = GridRespData;
@ -109,18 +109,20 @@ namespace OpenSim.Region.Communications.OGS1
List<RegionInfo> neighbours = new List<RegionInfo>();
foreach (ArrayList a in respData.Values)
foreach (ArrayList neighboursList in respData.Values)
{
foreach (Hashtable n in a)
foreach (Hashtable neighbourData in neighboursList)
{
uint regX = Convert.ToUInt32(n["x"]);
uint regY = Convert.ToUInt32(n["y"]);
uint regX = Convert.ToUInt32(neighbourData["x"]);
uint regY = Convert.ToUInt32(neighbourData["y"]);
if ((regionInfo.RegionLocX != regX) || (regionInfo.RegionLocY != regY))
{
string externalIpStr = OpenSim.Framework.Utilities.Util.GetHostFromDNS((string)n["sim_ip"]).ToString();
uint port = Convert.ToUInt32(n["sim_port"]);
string externalUri = (string)n["sim_uri"];
string simIp = (string)neighbourData["sim_ip"];
uint port = Convert.ToUInt32(neighbourData["sim_port"]);
string externalUri = (string)neighbourData["sim_uri"];
string externalIpStr = OpenSim.Framework.Utilities.Util.GetHostFromDNS(simIp).ToString();
IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(externalIpStr), (int)port);
string neighbourExternalUri = externalUri;
RegionInfo neighbour = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalIpStr);
@ -128,10 +130,10 @@ namespace OpenSim.Region.Communications.OGS1
//OGS1
//neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally
neighbour.RegionName = (string)n["name"];
neighbour.RegionName = (string)neighbourData["name"];
//OGS1+
neighbour.SimUUID = (string)n["uuid"];
neighbour.SimUUID = new LLUUID((string) neighbourData["uuid"]);
neighbours.Add(neighbour);
}

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.OGS1
{
public class OGS1InventoryService : IInventoryServices