Works for grid login.

slimupdates
Diva Canto 2010-01-29 09:12:22 -08:00
parent c9e64d578d
commit 0c81966c0a
8 changed files with 123 additions and 27 deletions

View File

@ -149,6 +149,8 @@ namespace OpenSim.Framework
args["base_folder"] = OSD.FromUUID(BaseFolder); args["base_folder"] = OSD.FromUUID(BaseFolder);
args["caps_path"] = OSD.FromString(CapsPath); args["caps_path"] = OSD.FromString(CapsPath);
if (ChildrenCapSeeds != null)
{
OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count); OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds) foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
{ {
@ -159,7 +161,7 @@ namespace OpenSim.Framework
} }
if (ChildrenCapSeeds.Count > 0) if (ChildrenCapSeeds.Count > 0)
args["children_seeds"] = childrenSeeds; args["children_seeds"] = childrenSeeds;
}
args["child"] = OSD.FromBoolean(child); args["child"] = OSD.FromBoolean(child);
args["circuit_code"] = OSD.FromString(circuitcode.ToString()); args["circuit_code"] = OSD.FromString(circuitcode.ToString());
args["first_name"] = OSD.FromString(firstname); args["first_name"] = OSD.FromString(firstname);
@ -167,6 +169,7 @@ namespace OpenSim.Framework
args["inventory_folder"] = OSD.FromUUID(InventoryFolder); args["inventory_folder"] = OSD.FromUUID(InventoryFolder);
args["secure_session_id"] = OSD.FromUUID(SecureSessionID); args["secure_session_id"] = OSD.FromUUID(SecureSessionID);
args["session_id"] = OSD.FromUUID(SessionID); args["session_id"] = OSD.FromUUID(SessionID);
args["service_session_id"] = OSD.FromString(ServiceSessionID); args["service_session_id"] = OSD.FromString(ServiceSessionID);
args["start_pos"] = OSD.FromString(startpos.ToString()); args["start_pos"] = OSD.FromString(startpos.ToString());
args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);
@ -250,6 +253,8 @@ namespace OpenSim.Framework
} }
} }
} }
else
ChildrenCapSeeds = new Dictionary<ulong, string>();
if (args["child"] != null) if (args["child"] != null)
child = args["child"].AsBoolean(); child = args["child"].AsBoolean();
@ -267,6 +272,7 @@ namespace OpenSim.Framework
SessionID = args["session_id"].AsUUID(); SessionID = args["session_id"].AsUUID();
if (args["service_session_id"] != null) if (args["service_session_id"] != null)
ServiceSessionID = args["service_session_id"].AsString(); ServiceSessionID = args["service_session_id"].AsString();
if (args["start_pos"] != null) if (args["start_pos"] != null)
Vector3.TryParse(args["start_pos"].AsString(), out startpos); Vector3.TryParse(args["start_pos"].AsString(), out startpos);

View File

@ -97,7 +97,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
} }
protected void OnNewClient(IClientAPI client) protected virtual void OnNewClient(IClientAPI client)
{ {
client.OnTeleportHomeRequest += TeleportHome; client.OnTeleportHomeRequest += TeleportHome;
} }
@ -268,6 +268,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (sp.ParentID != (uint)0) if (sp.ParentID != (uint)0)
sp.StandUp(); sp.StandUp();
m_log.Debug("XXX HERE 1");
if (!sp.ValidateAttachments()) if (!sp.ValidateAttachments())
{ {
sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state");
@ -978,12 +979,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle)
{ {
AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
agent.BaseFolder = UUID.Zero; agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero;
agent.startpos = new Vector3(128, 128, 70); agent.startpos = new Vector3(128, 128, 70);
agent.child = true; agent.child = true;
agent.Appearance = sp.Appearance; agent.Appearance = sp.Appearance;
if (currentAgentCircuit != null)
agent.ServiceURLs = currentAgentCircuit.ServiceURLs;
if (newRegions.Contains(neighbour.RegionHandle)) if (newRegions.Contains(neighbour.RegionHandle))
{ {

View File

@ -85,8 +85,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
} }
void OnNewClient(IClientAPI client) protected override void OnNewClient(IClientAPI client)
{ {
base.OnNewClient(client);
client.OnLogout += new Action<IClientAPI>(OnLogout); client.OnLogout += new Action<IClientAPI>(OnLogout);
} }
@ -118,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected override GridRegion GetFinalDestination(GridRegion region) protected override GridRegion GetFinalDestination(GridRegion region)
{ {
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID); int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID);
//m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags);
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
{ {
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
@ -129,7 +130,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
{ {
if (base.NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
return true; return true;
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
return true;
return false;
} }
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
@ -139,6 +147,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
{ {
// this user is going to another grid // this user is going to another grid
if (agentCircuit.ServiceURLs.ContainsKey("HomeURI"))
{
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver);
bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
@ -148,6 +158,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return success; return success;
} }
else
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent does not have a HomeURI address");
return false;
}
}
return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
} }
@ -220,6 +236,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
void OnLogout(IClientAPI obj) void OnLogout(IClientAPI obj)
{ {
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: client {0} logged out in {1}", obj.AgentId, obj.Scene.RegionInfo.RegionName);
AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))

View File

@ -109,6 +109,8 @@ namespace OpenSim.Server.Handlers.Grid
case "get_fallback_regions": case "get_fallback_regions":
return GetFallbackRegions(request); return GetFallbackRegions(request);
case "get_region_flags":
return GetRegionFlags(request);
} }
m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
} }
@ -481,6 +483,33 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString); return encoding.GetBytes(xmlString);
} }
byte[] GetRegionFlags(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
UUID regionID = UUID.Zero;
if (request.ContainsKey("REGIONID"))
UUID.TryParse(request["REGIONID"].ToString(), out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
int flags = m_GridService.GetRegionFlags(scopeID, regionID);
// m_log.DebugFormat("[GRID HANDLER]: flags for region {0}: {1}", regionID, flags);
Dictionary<string, object> result = new Dictionary<string, object>();
result["result"] = flags.ToString();
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
#endregion #endregion
#region Misc #region Misc

View File

@ -564,7 +564,47 @@ namespace OpenSim.Services.Connectors
public int GetRegionFlags(UUID scopeID, UUID regionID) public int GetRegionFlags(UUID scopeID, UUID regionID)
{ {
return 0; Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["REGIONID"] = regionID.ToString();
sendData["METHOD"] = "get_region_flags";
string reply = string.Empty;
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return -1;
}
int flags = -1;
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
{
Int32.TryParse((string)replyData["result"], out flags);
//else
// m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received wrong type {2}",
// scopeID, regionID, replyData["result"].GetType());
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received null response",
scopeID, regionID);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags received null reply");
return flags;
} }
#endregion #endregion

View File

@ -105,6 +105,8 @@ namespace OpenSim.Services.Connectors.Simulation
// Fill it in // Fill it in
OSDMap args = PackCreateAgentArguments(aCircuit, destination, flags); OSDMap args = PackCreateAgentArguments(aCircuit, destination, flags);
if (args == null)
return false;
string strBuffer = ""; string strBuffer = "";
byte[] buffer = new byte[1]; byte[] buffer = new byte[1];
@ -210,6 +212,7 @@ namespace OpenSim.Services.Connectors.Simulation
catch (Exception e) catch (Exception e)
{ {
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); m_log.Debug("[REMOTE SIMULATION CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
return null;
} }
// Add the input arguments // Add the input arguments
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());

View File

@ -13,7 +13,7 @@
;; HG1.5 handlers are: OpenSim.Server.Handlers.dll:GatekeeperService,OpenSim.Server.Handlers.dll:UserAgentService ;; HG1.5 handlers are: OpenSim.Server.Handlers.dll:GatekeeperService,OpenSim.Server.Handlers.dll:UserAgentService
ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.Server.Handlers.dll:InventoryServiceInConnector,OpenSim.Server.Handlers.dll:FreeswitchServerConnector,OpenSim.Server.Handlers.dll:GridServiceConnector,OpenSim.Server.Handlers.dll:GridInfoServerInConnector,OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,OpenSim.Server.Handlers.dll:OpenIdServerConnector,OpenSim.Server.Handlers.dll:AvatarServiceConnector,OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,OpenSim.Server.Handlers.dll:PresenceServiceConnector,OpenSim.Server.Handlers.dll:UserAccountServiceConnector,OpenSim.Server.Handlers.dll:GatekeeperService,OpenSim.Server.Handlers.dll:UserAgentService" ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.Server.Handlers.dll:InventoryServiceInConnector,OpenSim.Server.Handlers.dll:FreeswitchServerConnector,OpenSim.Server.Handlers.dll:GridServiceConnector,OpenSim.Server.Handlers.dll:GridInfoServerInConnector,OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,OpenSim.Server.Handlers.dll:OpenIdServerConnector,OpenSim.Server.Handlers.dll:AvatarServiceConnector,OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,OpenSim.Server.Handlers.dll:PresenceServiceConnector,OpenSim.Server.Handlers.dll:UserAccountServiceConnector,OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,OpenSim.Server.Handlers.dll:UserAgentServerConnector"
; * This is common for all services, it's the network setup for the entire ; * This is common for all services, it's the network setup for the entire
; * server instance ; * server instance
@ -155,8 +155,9 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"
AuthenticationService = "OpenSim.Services.Connectors.dll:AuthenticationServicesConnector" AuthenticationService = "OpenSim.Services.Connectors.dll:AuthenticationServicesConnector"
SimulationService ="OpenSim.Services.Connectors.dll:SimulationServiceConnector"
; how does the outside world reach me? This acts as public key too. ; how does the outside world reach me? This acts as public key too.
ExternalName = "http://127.0.0.1:8002" ExternalName = "http://127.0.0.1:8003"
[UserAgentService] [UserAgentService]
LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService" LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService"

View File

@ -40,12 +40,8 @@
[GridService] [GridService]
; for the HGGridServicesConnector to instantiate ; for the HGGridServicesConnector to instantiate
GridServiceConnectorModule = "OpenSim.Region.CoreModules.dll:RemoteGridServicesConnector" GridServiceConnectorModule = "OpenSim.Region.CoreModules.dll:RemoteGridServicesConnector"
HypergridService = "OpenSim.Services.HypergridService.dll:HypergridService"
; RemoteGridServicesConnector instantiates a LocalGridServicesConnector, ; RemoteGridServicesConnector instantiates a LocalGridServicesConnector,
; which in turn uses this ; which in turn uses this
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
[HypergridService]
GridService = "OpenSim.Services.GridService.dll:GridService"
AssetService = "OpenSim.Services.AssetService.dll:AssetService"