From 4dc75e4b76e802d06faef5aa14beeced62eadcb5 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Fri, 2 May 2008 18:18:43 +0000
Subject: * More clientstack abstractions - We now only have a single
constructor call to UDPServer. Going to reduce this with an abstracted
constructor in a bit.
---
OpenSim/Region/Application/OpenSimMain.cs | 10 +++++-----
OpenSim/Region/ClientStack/IClientNetworkServer.cs | 5 +++++
.../Region/ClientStack/LindenUDP/LLUDPServer.cs | 22 ++++++++++++++++------
.../Region/ClientStack/RegionApplicationBase.cs | 8 ++++----
4 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 1f67c6a..7924421 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -453,7 +453,7 @@ namespace OpenSim
///
///
///
- public LLUDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
+ public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
{
return CreateRegion(regionInfo, portadd_flag, false);
}
@@ -464,7 +464,7 @@ namespace OpenSim
///
///
///
- public LLUDPServer CreateRegion(RegionInfo regionInfo)
+ public IClientNetworkServer CreateRegion(RegionInfo regionInfo)
{
return CreateRegion(regionInfo, false, true);
}
@@ -476,7 +476,7 @@ namespace OpenSim
///
///
///
- public LLUDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init)
+ public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init)
{
int port = regionInfo.InternalEndPoint.Port;
@@ -496,7 +496,7 @@ namespace OpenSim
Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
}
- LLUDPServer udpServer;
+ IClientNetworkServer udpServer;
Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions);
m_log.Info("[MODULES]: Loading Region's modules");
@@ -551,7 +551,7 @@ namespace OpenSim
m_clientServers.Add(udpServer);
m_regionData.Add(regionInfo);
- udpServer.ServerListener();
+ udpServer.Start();
if (do_post_init)
{
diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
index f15404c..4f6f638 100644
--- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs
+++ b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
@@ -1,5 +1,6 @@
using System.Net.Sockets;
using OpenSim.Framework;
+using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.ClientStack
{
@@ -7,5 +8,9 @@ namespace OpenSim.Region.ClientStack
{
Socket Server { get; }
bool HandlesRegion(Location x);
+ void AddScene(Scene x);
+
+ void Start();
+ void Stop();
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index f85dcc2..b5ace50 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -35,6 +35,7 @@ using log4net;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.ClientStack.LindenUDP;
+using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.ClientStack.LindenUDP
{
@@ -95,6 +96,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return x == m_location;
}
+ public void AddScene(Scene x)
+ {
+ LocalScene = x;
+ }
+
+ public void Start()
+ {
+ ServerListener();
+ }
+
+ public void Stop()
+ {
+ m_socket.Close();
+ }
+
public LLUDPServer()
{
}
@@ -318,12 +334,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ack_it.Header.Reliable = false;
SendPacketTo(ack_it.ToBytes(),ack_it.ToBytes().Length,SocketFlags.None,p.CircuitCode.Code);
}
- else
- {
- // invalid client
- //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now
- //m_log.Warn("[UDPSERVER]: Got a packet from an invalid client - " + packet.ToString());
- }
}
catch (Exception)
{
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 1102fb4..3fa2371 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -107,12 +107,12 @@ namespace OpenSim.Region.ClientStack
return physicsPluginManager.GetPhysicsScene(engine, meshEngine);
}
- protected Scene SetupScene(RegionInfo regionInfo, out LLUDPServer udpServer, bool m_permissions)
+ protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer udpServer, bool m_permissions)
{
return SetupScene(regionInfo, 0, out udpServer, m_permissions);
}
- protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out LLUDPServer udpServer, bool m_permissions)
+ protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out IClientNetworkServer udpServer, bool m_permissions)
{
AgentCircuitManager circuitManager = new AgentCircuitManager();
IPAddress listenIP = regionInfo.InternalEndPoint.Address;
@@ -124,8 +124,8 @@ namespace OpenSim.Region.ClientStack
regionInfo.InternalEndPoint.Port = (int)port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
-
- udpServer.LocalScene = scene;
+
+ udpServer.AddScene(scene);
scene.LoadWorldMap();
--
cgit v1.1