aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-05-31 15:31:31 +0000
committerMW2007-05-31 15:31:31 +0000
commit564a97b508fd23601cd41075aa6a1f7de0800b41 (patch)
treee2cd67317ac84a1468b3a425b011e8df7b7b7d5b
parentMore work on OpenGrid.Framework.Communications (diff)
downloadopensim-SC_OLD-564a97b508fd23601cd41075aa6a1f7de0800b41.zip
opensim-SC_OLD-564a97b508fd23601cd41075aa6a1f7de0800b41.tar.gz
opensim-SC_OLD-564a97b508fd23601cd41075aa6a1f7de0800b41.tar.bz2
opensim-SC_OLD-564a97b508fd23601cd41075aa6a1f7de0800b41.tar.xz
Implementing a test Communications manager to test some of the interfaces (likely this test version will morph into the sandbox version)
-rw-r--r--Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs17
-rw-r--r--Common/OpenSim.Framework/IRegionCommsHost.cs2
-rw-r--r--Common/OpenSim.Framework/RegionCommsHostBase.cs4
-rw-r--r--Common/OpenSim.Servers/LocalUserProfileManager.cs4
-rw-r--r--Common/OpenSim.Servers/LoginServer.cs5
-rw-r--r--OpenSim/OpenSim.World/OpenSim.World.csproj4
-rw-r--r--OpenSim/OpenSim.World/World.cs29
-rw-r--r--OpenSim/OpenSim/OpenSim.csproj4
-rw-r--r--OpenSim/OpenSim/OpenSimMain.cs10
9 files changed, 60 insertions, 19 deletions
diff --git a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs b/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs
index 57049fc..b4fe696 100644
--- a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs
+++ b/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs
@@ -11,8 +11,8 @@ namespace OpenGrid.Framework.Communications
11{ 11{
12 public class TestLocalCommsManager : RegionServerCommsManager 12 public class TestLocalCommsManager : RegionServerCommsManager
13 { 13 {
14 protected Dictionary<uint , RegionInfo> regions = new Dictionary<uint,RegionInfo>(); 14 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong,RegionInfo>();
15 protected Dictionary<uint, RegionCommsHostBase> regionHosts = new Dictionary<uint, RegionCommsHostBase>(); 15 protected Dictionary<ulong, RegionCommsHostBase> regionHosts = new Dictionary<ulong, RegionCommsHostBase>();
16 16
17 public TestLocalCommsManager() 17 public TestLocalCommsManager()
18 { 18 {
@@ -28,9 +28,9 @@ namespace OpenGrid.Framework.Communications
28 { 28 {
29 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) 29 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
30 { 30 {
31 this.regions.Add((uint)regionInfo.RegionHandle, regionInfo); 31 this.regions.Add(regionInfo.RegionHandle, regionInfo);
32 RegionCommsHostBase regionHost = new RegionCommsHostBase(); 32 RegionCommsHostBase regionHost = new RegionCommsHostBase();
33 this.regionHosts.Add((uint)regionInfo.RegionHandle, regionHost); 33 this.regionHosts.Add(regionInfo.RegionHandle, regionHost);
34 34
35 return regionHost; 35 return regionHost;
36 } 36 }
@@ -59,13 +59,14 @@ namespace OpenGrid.Framework.Communications
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// 62 /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
63 /// </summary> 63 /// </summary>
64 /// <param name="regionHandle"></param> 64 /// <param name="regionHandle"></param>
65 /// <param name="loginData"></param> 65 /// <param name="loginData"></param>
66 /// <returns></returns> 66 /// <returns></returns>
67 public bool AddNewSession(uint regionHandle, Login loginData) 67 public bool AddNewSession(ulong regionHandle, Login loginData)
68 { 68 {
69 Console.WriteLine(" comms manager been told to expect new user");
69 AgentCircuitData agent = new AgentCircuitData(); 70 AgentCircuitData agent = new AgentCircuitData();
70 agent.AgentID = loginData.Agent; 71 agent.AgentID = loginData.Agent;
71 agent.firstname = loginData.First; 72 agent.firstname = loginData.First;
@@ -77,9 +78,9 @@ namespace OpenGrid.Framework.Communications
77 agent.InventoryFolder = loginData.InventoryFolder; 78 agent.InventoryFolder = loginData.InventoryFolder;
78 agent.startpos = new LLVector3(128, 128, 70); 79 agent.startpos = new LLVector3(128, 128, 70);
79 80
80 if (this.regionHosts.ContainsKey((uint)regionHandle)) 81 if (this.regionHosts.ContainsKey(regionHandle))
81 { 82 {
82 this.regionHosts[(uint)regionHandle].TriggerExpectUser(agent); 83 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent);
83 return true; 84 return true;
84 } 85 }
85 86
diff --git a/Common/OpenSim.Framework/IRegionCommsHost.cs b/Common/OpenSim.Framework/IRegionCommsHost.cs
index d115bb7..c56383e 100644
--- a/Common/OpenSim.Framework/IRegionCommsHost.cs
+++ b/Common/OpenSim.Framework/IRegionCommsHost.cs
@@ -6,7 +6,7 @@ using OpenSim.Framework.Types;
6 6
7namespace OpenSim.Framework 7namespace OpenSim.Framework
8{ 8{
9 public delegate void ExpectUserDelegate(AgentCircuitData agent); 9 public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent);
10 public delegate void UpdateNeighbours(List<RegionInfo> neighbours); 10 public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
11 11
12 public interface IRegionCommsHost 12 public interface IRegionCommsHost
diff --git a/Common/OpenSim.Framework/RegionCommsHostBase.cs b/Common/OpenSim.Framework/RegionCommsHostBase.cs
index 782755e..41babe7 100644
--- a/Common/OpenSim.Framework/RegionCommsHostBase.cs
+++ b/Common/OpenSim.Framework/RegionCommsHostBase.cs
@@ -18,11 +18,11 @@ namespace OpenSim.Framework
18 /// </summary> 18 /// </summary>
19 /// <param name="agent"></param> 19 /// <param name="agent"></param>
20 /// <returns></returns> 20 /// <returns></returns>
21 public virtual bool TriggerExpectUser(AgentCircuitData agent) 21 public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
22 { 22 {
23 if(OnExpectUser != null) 23 if(OnExpectUser != null)
24 { 24 {
25 OnExpectUser(agent); 25 OnExpectUser(regionHandle, agent);
26 return true; 26 return true;
27 } 27 }
28 28
diff --git a/Common/OpenSim.Servers/LocalUserProfileManager.cs b/Common/OpenSim.Servers/LocalUserProfileManager.cs
index a8b5f1f..99c640a 100644
--- a/Common/OpenSim.Servers/LocalUserProfileManager.cs
+++ b/Common/OpenSim.Servers/LocalUserProfileManager.cs
@@ -116,8 +116,8 @@ namespace OpenSim.UserServer
116 Console.WriteLine("adding login data to gridserver"); 116 Console.WriteLine("adding login data to gridserver");
117 ((LocalGridBase)this.m_gridServer).AddNewSession(_login); 117 ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
118 }*/ 118 }*/
119 119 ulong reghand = Helpers.UIntsToLong((regionX * 256), (regionY * 256));
120 this.AddSession(_login); 120 this.AddSession(reghand, _login);
121 } 121 }
122 } 122 }
123} 123}
diff --git a/Common/OpenSim.Servers/LoginServer.cs b/Common/OpenSim.Servers/LoginServer.cs
index 6fd174b..d02c41e 100644
--- a/Common/OpenSim.Servers/LoginServer.cs
+++ b/Common/OpenSim.Servers/LoginServer.cs
@@ -47,7 +47,7 @@ using OpenSim.Framework.Types;
47 47
48namespace OpenSim.UserServer 48namespace OpenSim.UserServer
49{ 49{
50 public delegate void AddNewSessionHandler(Login loginData); 50 public delegate bool AddNewSessionHandler(ulong regionHandle, Login loginData);
51 /// <summary> 51 /// <summary>
52 /// When running in local (default) mode , handles client logins. 52 /// When running in local (default) mode , handles client logins.
53 /// </summary> 53 /// </summary>
@@ -196,7 +196,8 @@ namespace OpenSim.UserServer
196 { 196 {
197 ((LocalGridBase)m_gridServer).AddNewSession(_login); 197 ((LocalGridBase)m_gridServer).AddNewSession(_login);
198 }*/ 198 }*/
199 AddSession(_login); 199 ulong reghand = Helpers.UIntsToLong((regionX * 256), (regionY * 256));
200 AddSession(reghand,_login);
200 201
201 return response; 202 return response;
202 } 203 }
diff --git a/OpenSim/OpenSim.World/OpenSim.World.csproj b/OpenSim/OpenSim.World/OpenSim.World.csproj
index 37293e1..78025d3 100644
--- a/OpenSim/OpenSim.World/OpenSim.World.csproj
+++ b/OpenSim/OpenSim.World/OpenSim.World.csproj
@@ -87,6 +87,10 @@
87 </Reference> 87 </Reference>
88 </ItemGroup> 88 </ItemGroup>
89 <ItemGroup> 89 <ItemGroup>
90 <ProjectReference Include="..\..\Common\OpenGrid.Framework.Communications\OpenGrid.Framework.Communications.csproj">
91 <Project>{C9702041-922C-452A-A1B4-7880AF53149A}</Project>
92 <Name>OpenGrid.Framework.Communications</Name>
93 </ProjectReference>
90 <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj"> 94 <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj">
91 <Name>OpenSim.Terrain.BasicTerrain</Name> 95 <Name>OpenSim.Terrain.BasicTerrain</Name>
92 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> 96 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs
index c731dbc..69d4646 100644
--- a/OpenSim/OpenSim.World/World.cs
+++ b/OpenSim/OpenSim.World/World.cs
@@ -14,6 +14,7 @@ using OpenSim.Framework.Inventory;
14using OpenSim.Framework; 14using OpenSim.Framework;
15using OpenSim.RegionServer.world.scripting; 15using OpenSim.RegionServer.world.scripting;
16using OpenSim.Terrain; 16using OpenSim.Terrain;
17using OpenGrid.Framework.Communications;
17 18
18namespace OpenSim.world 19namespace OpenSim.world
19{ 20{
@@ -36,6 +37,8 @@ namespace OpenSim.world
36 private Mutex updateLock; 37 private Mutex updateLock;
37 public string m_datastore; 38 public string m_datastore;
38 protected AuthenticateSessionsBase authenticateHandler; 39 protected AuthenticateSessionsBase authenticateHandler;
40 protected RegionCommsHostBase regionCommsHost;
41 protected RegionServerCommsManager commsManager;
39 42
40 #region Properties 43 #region Properties
41 /// <summary> 44 /// <summary>
@@ -61,17 +64,19 @@ namespace OpenSim.world
61 /// <param name="clientThreads">Dictionary to contain client threads</param> 64 /// <param name="clientThreads">Dictionary to contain client threads</param>
62 /// <param name="regionHandle">Region Handle for this region</param> 65 /// <param name="regionHandle">Region Handle for this region</param>
63 /// <param name="regionName">Region Name for this region</param> 66 /// <param name="regionName">Region Name for this region</param>
64 public World(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen) 67 public World(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, RegionServerCommsManager commsMan)
65 { 68 {
66 try 69 try
67 { 70 {
68 updateLock = new Mutex(false); 71 updateLock = new Mutex(false);
69 this.authenticateHandler = authen; 72 this.authenticateHandler = authen;
73 this.commsManager = commsMan;
70 m_clientThreads = clientThreads; 74 m_clientThreads = clientThreads;
71 m_regInfo = regInfo; 75 m_regInfo = regInfo;
72 m_regionHandle = m_regInfo.RegionHandle; 76 m_regionHandle = m_regInfo.RegionHandle;
73 m_regionName = m_regInfo.RegionName; 77 m_regionName = m_regInfo.RegionName;
74 this.m_datastore = m_regInfo.DataStore; 78 this.m_datastore = m_regInfo.DataStore;
79 this.RegisterRegionWithComms();
75 80
76 m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>(); 81 m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>();
77 m_scripts = new Dictionary<string, ScriptFactory>(); 82 m_scripts = new Dictionary<string, ScriptFactory>();
@@ -540,5 +545,27 @@ namespace OpenSim.world
540 } 545 }
541 #endregion 546 #endregion
542 547
548 #region RegionCommsHost
549
550 public void RegisterRegionWithComms()
551 {
552 this.regionCommsHost = this.commsManager.RegisterRegion(this.m_regInfo);
553 if (this.regionCommsHost != null)
554 {
555 this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection);
556 }
557 }
558
559 public void NewUserConnection(ulong regionHandle,AgentCircuitData agent)
560 {
561 Console.WriteLine("World.cs - add new user connection");
562 //should just check that its meant for this region
563 if (regionHandle == this.m_regInfo.RegionHandle)
564 {
565 this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
566 }
567 }
568
569 #endregion
543 } 570 }
544} 571}
diff --git a/OpenSim/OpenSim/OpenSim.csproj b/OpenSim/OpenSim/OpenSim.csproj
index 79abd9e..03ae6ab 100644
--- a/OpenSim/OpenSim/OpenSim.csproj
+++ b/OpenSim/OpenSim/OpenSim.csproj
@@ -87,6 +87,10 @@
87 </Reference> 87 </Reference>
88 </ItemGroup> 88 </ItemGroup>
89 <ItemGroup> 89 <ItemGroup>
90 <ProjectReference Include="..\..\Common\OpenGrid.Framework.Communications\OpenGrid.Framework.Communications.csproj">
91 <Project>{C9702041-922C-452A-A1B4-7880AF53149A}</Project>
92 <Name>OpenGrid.Framework.Communications</Name>
93 </ProjectReference>
90 <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj"> 94 <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj">
91 <Name>OpenSim.Terrain.BasicTerrain</Name> 95 <Name>OpenSim.Terrain.BasicTerrain</Name>
92 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> 96 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs
index 4aa48bd..66aadb0 100644
--- a/OpenSim/OpenSim/OpenSimMain.cs
+++ b/OpenSim/OpenSim/OpenSimMain.cs
@@ -51,6 +51,7 @@ using OpenSim.Physics.Manager;
51using Nwc.XmlRpc; 51using Nwc.XmlRpc;
52using OpenSim.Servers; 52using OpenSim.Servers;
53using OpenSim.GenericConfig; 53using OpenSim.GenericConfig;
54using OpenGrid.Framework.Communications;
54 55
55namespace OpenSim 56namespace OpenSim
56{ 57{
@@ -58,6 +59,7 @@ namespace OpenSim
58 public class OpenSimMain : RegionServerBase, conscmd_callback 59 public class OpenSimMain : RegionServerBase, conscmd_callback
59 { 60 {
60 private CheckSumServer checkServer; 61 private CheckSumServer checkServer;
62 protected RegionServerCommsManager commsManager;
61 63
62 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) 64 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile)
63 { 65 {
@@ -101,10 +103,12 @@ namespace OpenSim
101 this.SetupLocalGridServers(); 103 this.SetupLocalGridServers();
102 this.checkServer = new CheckSumServer(12036); 104 this.checkServer = new CheckSumServer(12036);
103 this.checkServer.ServerListener(); 105 this.checkServer.ServerListener();
106 this.commsManager = new TestLocalCommsManager();
104 } 107 }
105 else 108 else
106 { 109 {
107 this.SetupRemoteGridServers(); 110 this.SetupRemoteGridServers();
111 this.commsManager = new TestLocalCommsManager(); //should be a remote comms manager class
108 } 112 }
109 113
110 startuptime = DateTime.Now; 114 startuptime = DateTime.Now;
@@ -126,8 +130,8 @@ namespace OpenSim
126 { 130 {
127 loginServer = new LoginServer(regionData[0].IPListenAddr, regionData[0].IPListenPort, regionData[0].RegionLocX, regionData[0].RegionLocY, false); 131 loginServer = new LoginServer(regionData[0].IPListenAddr, regionData[0].IPListenPort, regionData[0].RegionLocX, regionData[0].RegionLocY, false);
128 loginServer.Startup(); 132 loginServer.Startup();
129 loginServer.SetSessionHandler(((AuthenticateSessionsLocal)this.AuthenticateSessionsHandler[0]).AddNewSession); 133 //loginServer.SetSessionHandler(((AuthenticateSessionsLocal)this.AuthenticateSessionsHandler[0]).AddNewSession);
130 134 loginServer.SetSessionHandler(((TestLocalCommsManager)this.commsManager).AddNewSession);
131 //sandbox mode with loginserver not using accounts 135 //sandbox mode with loginserver not using accounts
132 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); 136 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
133 } 137 }
@@ -234,7 +238,7 @@ namespace OpenSim
234 m_console.componentname = "Region " + regionData.RegionName; 238 m_console.componentname = "Region " + regionData.RegionName;
235 */ 239 */
236 240
237 LocalWorld = new World(udpServer.PacketServer.ClientAPIs, regionDat, authenBase); 241 LocalWorld = new World(udpServer.PacketServer.ClientAPIs, regionDat, authenBase, commsManager);
238 this.m_localWorld.Add(LocalWorld); 242 this.m_localWorld.Add(LocalWorld);
239 //LocalWorld.InventoryCache = InventoryCache; 243 //LocalWorld.InventoryCache = InventoryCache;
240 //LocalWorld.AssetCache = AssetCache; 244 //LocalWorld.AssetCache = AssetCache;