preliminary inter region communications (between regions in different instances) now works, so child agents and border crossings (and teleporting) now work.
The .net remoting is still very basic: we need security sinks added. And we really need the OGS 2 protocol as soon as possible.Sugilite
parent
ebdc64730a
commit
f0ecc1de4c
|
@ -26,9 +26,11 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Types
|
namespace OpenSim.Framework.Types
|
||||||
{
|
{
|
||||||
|
[Serializable]
|
||||||
public class AgentCircuitData
|
public class AgentCircuitData
|
||||||
{
|
{
|
||||||
public AgentCircuitData() { }
|
public AgentCircuitData() { }
|
||||||
|
|
|
@ -130,6 +130,7 @@ namespace OpenSim.Framework.Types
|
||||||
m_remotingPort = value;
|
m_remotingPort = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string RemotingAddress;
|
||||||
|
|
||||||
public string DataStore = "";
|
public string DataStore = "";
|
||||||
public bool isSandbox = false;
|
public bool isSandbox = false;
|
||||||
|
|
|
@ -266,6 +266,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
|
TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
|
||||||
TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
|
TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
|
||||||
TheSim.regionLocZ = 0;
|
TheSim.regionLocZ = 0;
|
||||||
|
TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
|
||||||
|
|
||||||
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
|
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
|
||||||
System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle);
|
System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle);
|
||||||
|
@ -392,16 +393,19 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
else if (requestData.ContainsKey("region_handle"))
|
else if (requestData.ContainsKey("region_handle"))
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]);
|
||||||
simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"]));
|
simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simData == null)
|
if (simData == null)
|
||||||
{
|
{
|
||||||
//Sim does not exist
|
//Sim does not exist
|
||||||
|
Console.WriteLine("region not found");
|
||||||
responseData["error"] = "Sim does not exist";
|
responseData["error"] = "Sim does not exist";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("found region");
|
||||||
responseData["sim_ip"] = simData.serverIP;
|
responseData["sim_ip"] = simData.serverIP;
|
||||||
responseData["sim_port"] = simData.serverPort.ToString();
|
responseData["sim_port"] = simData.serverPort.ToString();
|
||||||
responseData["http_port"] = simData.httpPort.ToString();
|
responseData["http_port"] = simData.httpPort.ToString();
|
||||||
|
@ -493,7 +497,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
simProfileBlock["region-flags"] = 0;
|
simProfileBlock["region-flags"] = 0;
|
||||||
simProfileBlock["water-height"] = 20;
|
simProfileBlock["water-height"] = 20;
|
||||||
simProfileBlock["agents"] = 1;
|
simProfileBlock["agents"] = 1;
|
||||||
simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString();
|
simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated();
|
||||||
|
|
||||||
// For Sugilite compatibility
|
// For Sugilite compatibility
|
||||||
simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
|
simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
serversInfo = servers_info;
|
serversInfo = servers_info;
|
||||||
httpServer = httpServe;
|
httpServer = httpServe;
|
||||||
httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser);
|
httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser);
|
||||||
|
this.StartRemoting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
|
public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
|
||||||
|
@ -52,6 +53,7 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
GridParams["sim_name"] = regionInfo.RegionName;
|
GridParams["sim_name"] = regionInfo.RegionName;
|
||||||
GridParams["http_port"] = serversInfo.HttpListenerPort.ToString();
|
GridParams["http_port"] = serversInfo.HttpListenerPort.ToString();
|
||||||
GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString();
|
GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString();
|
||||||
|
GridParams["map-image-id"] = regionInfo.estateSettings.terrainImageID.ToStringHyphenated();
|
||||||
|
|
||||||
// Package into an XMLRPC Request
|
// Package into an XMLRPC Request
|
||||||
ArrayList SendParams = new ArrayList();
|
ArrayList SendParams = new ArrayList();
|
||||||
|
@ -141,8 +143,40 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return this.regions[regionHandle];
|
return this.regions[regionHandle];
|
||||||
}
|
}
|
||||||
//TODO not a region in this instance so ask remote grid server
|
//TODO not a region in this instance so ask remote grid server
|
||||||
MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()");
|
|
||||||
return null;
|
Hashtable requestData = new Hashtable();
|
||||||
|
requestData["region_handle"] = regionHandle.ToString();
|
||||||
|
requestData["authkey"] = this.serversInfo.GridSendKey;
|
||||||
|
ArrayList SendParams = new ArrayList();
|
||||||
|
SendParams.Add(requestData);
|
||||||
|
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
||||||
|
XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000);
|
||||||
|
|
||||||
|
Hashtable responseData = (Hashtable)GridResp.Value;
|
||||||
|
|
||||||
|
if (responseData.ContainsKey("error"))
|
||||||
|
{
|
||||||
|
Console.WriteLine("error received from grid server" + responseData["error"]);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
|
||||||
|
uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
|
||||||
|
string internalIpStr = (string)responseData["sim_ip"];
|
||||||
|
uint port = Convert.ToUInt32(responseData["sim_port"]);
|
||||||
|
string externalUri = (string)responseData["sim_uri"];
|
||||||
|
|
||||||
|
IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port);
|
||||||
|
string neighbourExternalUri = externalUri;
|
||||||
|
RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
|
||||||
|
|
||||||
|
regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
|
||||||
|
regionInfo.RemotingAddress = internalIpStr;
|
||||||
|
|
||||||
|
regionInfo.SimUUID = new LLUUID((string)responseData["region_UUID"]);
|
||||||
|
regionInfo.RegionName = (string)responseData["region_name"];
|
||||||
|
|
||||||
|
return regionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
|
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
|
||||||
|
@ -164,7 +198,7 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
neighbour.Access = Convert.ToByte(n["access"]);
|
neighbour.Access = Convert.ToByte(n["access"]);
|
||||||
neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]);
|
neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]);
|
||||||
neighbour.WaterHeight = Convert.ToByte(n["water-height"]);
|
neighbour.WaterHeight = Convert.ToByte(n["water-height"]);
|
||||||
neighbour.MapImageId = (string)n["map-image-id"];
|
neighbour.MapImageId = new LLUUID((string)n["map-image-id"]);
|
||||||
|
|
||||||
neighbours.Add(neighbour);
|
neighbours.Add(neighbour);
|
||||||
}
|
}
|
||||||
|
@ -237,10 +271,10 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
#region InterRegion Comms
|
#region InterRegion Comms
|
||||||
private void StartRemoting()
|
private void StartRemoting()
|
||||||
{
|
{
|
||||||
TcpChannel ch = new TcpChannel(8895);
|
TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort);
|
||||||
ChannelServices.RegisterChannel(ch, true);
|
ChannelServices.RegisterChannel(ch, true);
|
||||||
|
|
||||||
WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton);
|
WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton);
|
||||||
RemotingConfiguration.RegisterWellKnownServiceType(wellType);
|
RemotingConfiguration.RegisterWellKnownServiceType(wellType);
|
||||||
InterRegionSingleton.Instance.OnArrival += this.IncomingArrival;
|
InterRegionSingleton.Instance.OnArrival += this.IncomingArrival;
|
||||||
InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent;
|
InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent;
|
||||||
|
@ -254,9 +288,31 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
|
this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//TODO need to see if we know about where this region is and use .net remoting
|
RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle);
|
||||||
// to inform it.
|
if (regInfo != null)
|
||||||
Console.WriteLine("Inform remote region of child agent not implemented yet");
|
{
|
||||||
|
//don't want to be creating a new link to the remote instance every time like we are here
|
||||||
|
bool retValue = false;
|
||||||
|
|
||||||
|
|
||||||
|
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
|
||||||
|
typeof(OGS1InterRegionRemoting),
|
||||||
|
"tcp://"+ regInfo.RemotingAddress+":"+regInfo.RemotingPort+"/InterRegions");
|
||||||
|
if (remObject != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("remoting object not found");
|
||||||
|
}
|
||||||
|
remObject = null;
|
||||||
|
|
||||||
|
|
||||||
|
return retValue;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,6 +323,29 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
|
this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle);
|
||||||
|
if (regInfo != null)
|
||||||
|
{
|
||||||
|
bool retValue = false;
|
||||||
|
|
||||||
|
|
||||||
|
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
|
||||||
|
typeof(OGS1InterRegionRemoting),
|
||||||
|
"tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions");
|
||||||
|
if (remObject != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("remoting object not found");
|
||||||
|
}
|
||||||
|
remObject = null;
|
||||||
|
|
||||||
|
|
||||||
|
return retValue;
|
||||||
|
}
|
||||||
//TODO need to see if we know about where this region is and use .net remoting
|
//TODO need to see if we know about where this region is and use .net remoting
|
||||||
// to inform it.
|
// to inform it.
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -269,6 +269,7 @@ namespace OpenSim.Region.GridInterfaces.Local
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("exception loading default assets into database");
|
||||||
Console.WriteLine(e.Message);
|
Console.WriteLine(e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue