From 3c8daee51027c5beb857e78c1972db0936761af3 Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 16 Jun 2007 14:29:11 +0000 Subject: Some Rearranging of CommsManager. --- .../CommunicationsLocal.cs | 51 ++++++ .../LocalBackEndServices.cs | 179 +++++++++++++++++++++ .../OpenSim.LocalCommunications.csproj | 106 ++++++++++++ .../OpenSim.LocalCommunications.csproj.user | 12 ++ .../OpenSim.LocalCommunications.dll.build | 45 ++++++ .../Properties/AssemblyInfo.cs | 35 ++++ OpenSim/OpenSim.Region/Scenes/Scene.cs | 6 +- OpenSim/OpenSim.RegionServer/ClientView.API.cs | 4 +- OpenSim/OpenSim/OpenSim.csproj | 6 + OpenSim/OpenSim/OpenSim.exe.build | 1 + OpenSim/OpenSim/OpenSimMain.cs | 9 +- 11 files changed, 446 insertions(+), 8 deletions(-) create mode 100644 OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs create mode 100644 OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs create mode 100644 OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj create mode 100644 OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj.user create mode 100644 OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.dll.build create mode 100644 OpenSim/OpenSim.LocalCommunications/Properties/AssemblyInfo.cs (limited to 'OpenSim') diff --git a/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs b/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs new file mode 100644 index 0000000..1cb5f6f --- /dev/null +++ b/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs @@ -0,0 +1,51 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenGrid.Framework.Communications; + +namespace OpenSim.LocalCommunications +{ + public class CommunicationsLocal : CommunicationsManager + { + public LocalBackEndServices SandManager = new LocalBackEndServices(); + + public CommunicationsLocal() + { + UserServer = null; + GridServer = SandManager; + InterSims = SandManager; + } + } +} diff --git a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs new file mode 100644 index 0000000..dfc4505 --- /dev/null +++ b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs @@ -0,0 +1,179 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; +using OpenGrid.Framework.Communications; +using libsecondlife; +using OpenSim.Framework.Types; +using OpenSim.Framework; + +namespace OpenSim.LocalCommunications +{ + + + public class LocalBackEndServices : IGridServices, IInterRegionCommunications + { + protected Dictionary regions = new Dictionary(); + protected Dictionary regionHosts = new Dictionary(); + + public LocalBackEndServices() + { + + } + + /// + /// Register a region method with the BackEnd Services. + /// + /// + /// + public RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) + { + //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); + if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) + { + //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); + this.regions.Add(regionInfo.RegionHandle, regionInfo); + RegionCommsHostBase regionHost = new RegionCommsHostBase(); + this.regionHosts.Add(regionInfo.RegionHandle, regionHost); + + return regionHost; + } + + //already in our list of regions so for now lets return null + return null; + } + + /// + /// + /// + /// + public List RequestNeighbours(RegionInfo regionInfo) + { + // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); + List neighbours = new List(); + + foreach (RegionInfo reg in this.regions.Values) + { + // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); + if (reg.RegionHandle != regionInfo.RegionHandle) + { + //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); + if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) + { + if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) + { + neighbours.Add(reg); + } + } + } + } + return neighbours; + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbourInfo(ulong regionHandle) + { + if (this.regions.ContainsKey(regionHandle)) + { + return this.regions[regionHandle]; + } + return null; + } + + /// + /// + /// + /// + /// + public bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData + { + //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); + if (this.regionHosts.ContainsKey(regionHandle)) + { + // Console.WriteLine("CommsManager- Informing a region to expect child agent"); + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + return false; + } + + /// + /// + /// + /// + /// + /// + /// + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.regionHosts.ContainsKey(regionHandle)) + { + // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); + this.regionHosts[regionHandle].ExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + return false; + } + + /// + /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session + /// + /// + /// + /// + public bool AddNewSession(ulong regionHandle, Login loginData) + { + //Console.WriteLine(" comms manager been told to expect new user"); + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = loginData.Agent; + agent.firstname = loginData.First; + agent.lastname = loginData.Last; + agent.SessionID = loginData.Session; + agent.SecureSessionID = loginData.SecureSession; + agent.circuitcode = loginData.CircuitCode; + agent.BaseFolder = loginData.BaseFolder; + agent.InventoryFolder = loginData.InventoryFolder; + agent.startpos = new LLVector3(128, 128, 70); + + if (this.regionHosts.ContainsKey(regionHandle)) + { + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); + return true; + } + + // region not found + return false; + } + } +} + diff --git a/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj b/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj new file mode 100644 index 0000000..95c9f98 --- /dev/null +++ b/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj @@ -0,0 +1,106 @@ + + + Local + 8.0.50727 + 2.0 + {79CED992-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.LocalCommunications + JScript + Grid + IE50 + false + Library + + OpenSim.LocalCommunications + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + ..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + + + OpenGrid.Framework.Communications + {683344D5-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj.user b/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj.user new file mode 100644 index 0000000..5941547 --- /dev/null +++ b/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\Sugilite\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.dll.build b/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.dll.build new file mode 100644 index 0000000..2ea6497 --- /dev/null +++ b/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.dll.build @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/OpenSim.LocalCommunications/Properties/AssemblyInfo.cs b/OpenSim/OpenSim.LocalCommunications/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8e6e711 --- /dev/null +++ b/OpenSim/OpenSim.LocalCommunications/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.LocalCommunications")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.LocalCommunications")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs index 2500ee6..c0eebd4 100644 --- a/OpenSim/OpenSim.Region/Scenes/Scene.cs +++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Scenes public string m_datastore; protected AuthenticateSessionsBase authenticateHandler; protected RegionCommsHostBase regionCommsHost; - protected RegionServerCommsManager commsManager; + protected CommunicationsManager commsManager; public ParcelManager parcelManager; public EstateManager estateManager; @@ -95,7 +95,7 @@ namespace OpenSim.Region.Scenes /// Dictionary to contain client threads /// Region Handle for this region /// Region Name for this region - public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, RegionServerCommsManager commsMan) + public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan) { try { @@ -416,7 +416,7 @@ namespace OpenSim.Region.Scenes Console.WriteLine("creating new terrain"); this.Terrain.hills(); - this.localStorage.SaveMap(this.Terrain.getHeights1D()); + // this.localStorage.SaveMap(this.Terrain.getHeights1D()); } else { diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs index b126004..0ace92c 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs @@ -314,13 +314,15 @@ namespace OpenSim public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort) { + LLVector3 look = new LLVector3(lookAt.X *10, lookAt.Y *10, lookAt.Z *10); + CrossedRegionPacket newSimPack = new CrossedRegionPacket(); newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); newSimPack.AgentData.AgentID = this.AgentID; newSimPack.AgentData.SessionID = this.SessionID; newSimPack.Info = new CrossedRegionPacket.InfoBlock(); newSimPack.Info.Position = pos; - newSimPack.Info.LookAt = lookAt; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! + newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! newSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); newSimPack.RegionData.RegionHandle = newRegionHandle; byte[] byteIP = newRegionIP.GetAddressBytes(); diff --git a/OpenSim/OpenSim/OpenSim.csproj b/OpenSim/OpenSim/OpenSim.csproj index 70f5ed3..fb0e0c1 100644 --- a/OpenSim/OpenSim/OpenSim.csproj +++ b/OpenSim/OpenSim/OpenSim.csproj @@ -110,6 +110,12 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False + + OpenSim.LocalCommunications + {79CED992-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + OpenSim.Physics.Manager {8BE16150-0000-0000-0000-000000000000} diff --git a/OpenSim/OpenSim/OpenSim.exe.build b/OpenSim/OpenSim/OpenSim.exe.build index 1ef8e8f..78e4fa3 100644 --- a/OpenSim/OpenSim/OpenSim.exe.build +++ b/OpenSim/OpenSim/OpenSim.exe.build @@ -27,6 +27,7 @@ + diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index 9fe9581..ea7f31e 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -53,6 +53,7 @@ using Nwc.XmlRpc; using OpenSim.Servers; using OpenSim.GenericConfig; using OpenGrid.Framework.Communications; +using OpenSim.LocalCommunications; namespace OpenSim { @@ -60,7 +61,7 @@ namespace OpenSim public class OpenSimMain : RegionApplicationBase, conscmd_callback { private CheckSumServer checkServer; - protected RegionServerCommsManager commsManager; + protected CommunicationsManager commsManager; public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) @@ -104,12 +105,12 @@ namespace OpenSim this.SetupLocalGridServers(); this.checkServer = new CheckSumServer(12036); this.checkServer.ServerListener(); - this.commsManager = new RegionServerCommsLocal(); + this.commsManager = new CommunicationsLocal(); } else { this.SetupRemoteGridServers(); - this.commsManager = new RegionServerCommsOGS(); + this.commsManager = new CommunicationsLocal(); //shouldn't be using the local communications manager } startuptime = DateTime.Now; @@ -131,7 +132,7 @@ namespace OpenSim { loginServer = new LoginServer(regionData[0].IPListenAddr, regionData[0].IPListenPort, regionData[0].RegionLocX, regionData[0].RegionLocY, false); loginServer.Startup(); - loginServer.SetSessionHandler(((RegionServerCommsLocal)this.commsManager).SandManager.AddNewSession); + loginServer.SetSessionHandler(((CommunicationsLocal)this.commsManager).SandManager.AddNewSession); //sandbox mode with loginserver not using accounts httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); } -- cgit v1.1