* Commit 2/3 - Please dont attempt to update to this revision until all 3 are in.
parent
c6236b5cf3
commit
29b8c84cea
|
@ -40,6 +40,7 @@ using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Statistics;
|
using OpenSim.Framework.Statistics;
|
||||||
using OpenSim.Region.ClientStack;
|
using OpenSim.Region.ClientStack;
|
||||||
|
using OpenSim.Region.ClientStack.LindenUDP;
|
||||||
using OpenSim.Region.Communications.Local;
|
using OpenSim.Region.Communications.Local;
|
||||||
using OpenSim.Region.Communications.OGS1;
|
using OpenSim.Region.Communications.OGS1;
|
||||||
using OpenSim.Region.Environment;
|
using OpenSim.Region.Environment;
|
||||||
|
@ -70,7 +71,7 @@ namespace OpenSim
|
||||||
|
|
||||||
protected string m_storageDll;
|
protected string m_storageDll;
|
||||||
|
|
||||||
protected List<UDPServer> m_udpServers = new List<UDPServer>();
|
protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
|
||||||
protected List<RegionInfo> m_regionData = new List<RegionInfo>();
|
protected List<RegionInfo> m_regionData = new List<RegionInfo>();
|
||||||
|
|
||||||
protected bool m_physicalPrim;
|
protected bool m_physicalPrim;
|
||||||
|
@ -105,9 +106,9 @@ namespace OpenSim
|
||||||
get { return m_httpServer; }
|
get { return m_httpServer; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UDPServer> UdpServers
|
public List<IClientNetworkServer> UdpServers
|
||||||
{
|
{
|
||||||
get { return m_udpServers; }
|
get { return m_clientServers; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RegionInfo> RegionData
|
public List<RegionInfo> RegionData
|
||||||
|
@ -327,7 +328,7 @@ namespace OpenSim
|
||||||
|
|
||||||
// We are done with startup
|
// We are done with startup
|
||||||
m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}",
|
m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}",
|
||||||
m_udpServers.Count.ToString(), m_udpServers.Count > 1 ? "s" : "");
|
m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : "");
|
||||||
WorldHasComeToAnEnd.WaitOne();
|
WorldHasComeToAnEnd.WaitOne();
|
||||||
m_log.Info("[OPENSIM MAIN]: Shutdown complete, goodbye.");
|
m_log.Info("[OPENSIM MAIN]: Shutdown complete, goodbye.");
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
|
@ -452,7 +453,7 @@ namespace OpenSim
|
||||||
/// <param name="regionInfo"></param>
|
/// <param name="regionInfo"></param>
|
||||||
/// <param name="portadd_flag"></param>
|
/// <param name="portadd_flag"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
|
public LLUDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
|
||||||
{
|
{
|
||||||
return CreateRegion(regionInfo, portadd_flag, false);
|
return CreateRegion(regionInfo, portadd_flag, false);
|
||||||
}
|
}
|
||||||
|
@ -463,7 +464,7 @@ namespace OpenSim
|
||||||
/// <param name="regionInfo"></param>
|
/// <param name="regionInfo"></param>
|
||||||
/// <param name="portadd_flag"></param>
|
/// <param name="portadd_flag"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public UDPServer CreateRegion(RegionInfo regionInfo)
|
public LLUDPServer CreateRegion(RegionInfo regionInfo)
|
||||||
{
|
{
|
||||||
return CreateRegion(regionInfo, false, true);
|
return CreateRegion(regionInfo, false, true);
|
||||||
}
|
}
|
||||||
|
@ -475,7 +476,7 @@ namespace OpenSim
|
||||||
/// <param name="portadd_flag"></param>
|
/// <param name="portadd_flag"></param>
|
||||||
/// <param name="do_post_init"></param>
|
/// <param name="do_post_init"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init)
|
public LLUDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init)
|
||||||
{
|
{
|
||||||
int port = regionInfo.InternalEndPoint.Port;
|
int port = regionInfo.InternalEndPoint.Port;
|
||||||
|
|
||||||
|
@ -495,7 +496,7 @@ namespace OpenSim
|
||||||
Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
|
Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
|
||||||
}
|
}
|
||||||
|
|
||||||
UDPServer udpServer;
|
LLUDPServer udpServer;
|
||||||
Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions);
|
Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions);
|
||||||
|
|
||||||
m_log.Info("[MODULES]: Loading Region's modules");
|
m_log.Info("[MODULES]: Loading Region's modules");
|
||||||
|
@ -548,7 +549,7 @@ namespace OpenSim
|
||||||
|
|
||||||
m_sceneManager.Add(scene);
|
m_sceneManager.Add(scene);
|
||||||
|
|
||||||
m_udpServers.Add(udpServer);
|
m_clientServers.Add(udpServer);
|
||||||
m_regionData.Add(regionInfo);
|
m_regionData.Add(regionInfo);
|
||||||
udpServer.ServerListener();
|
udpServer.ServerListener();
|
||||||
|
|
||||||
|
@ -586,9 +587,9 @@ namespace OpenSim
|
||||||
bool foundUDPServer = false;
|
bool foundUDPServer = false;
|
||||||
int UDPServerElement = 0;
|
int UDPServerElement = 0;
|
||||||
|
|
||||||
for (int i = 0; i < m_udpServers.Count; i++)
|
for (int i = 0; i < m_clientServers.Count; i++)
|
||||||
{
|
{
|
||||||
if (m_udpServers[i].RegionHandle == whichRegion.RegionHandle)
|
if (m_clientServers[i].HandlesRegion(new Location(whichRegion.RegionHandle)))
|
||||||
{
|
{
|
||||||
UDPServerElement = i;
|
UDPServerElement = i;
|
||||||
foundUDPServer = true;
|
foundUDPServer = true;
|
||||||
|
@ -598,8 +599,8 @@ namespace OpenSim
|
||||||
if (foundUDPServer)
|
if (foundUDPServer)
|
||||||
{
|
{
|
||||||
// m_udpServers[UDPServerElement].Server.End
|
// m_udpServers[UDPServerElement].Server.End
|
||||||
m_udpServers[UDPServerElement].Server.Close();
|
m_clientServers[UDPServerElement].Server.Close();
|
||||||
m_udpServers.RemoveAt(UDPServerElement);
|
m_clientServers.RemoveAt(UDPServerElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Removing the region from the sim's database of regions..
|
//Removing the region from the sim's database of regions..
|
||||||
|
|
|
@ -32,14 +32,13 @@ using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Timers;
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Statistics;
|
using OpenSim.Framework.Statistics;
|
||||||
using OpenSim.Region.ClientStack;
|
using OpenSim.Region.ClientStack.LindenUDP;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using Timer=System.Timers.Timer;
|
using Timer=System.Timers.Timer;
|
||||||
|
@ -111,8 +110,8 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
m_scriptTimer = new Timer();
|
m_scriptTimer = new Timer();
|
||||||
m_scriptTimer.Enabled = true;
|
m_scriptTimer.Enabled = true;
|
||||||
m_scriptTimer.Interval = (int)(1200 * 1000);
|
m_scriptTimer.Interval = 1200 * 1000;
|
||||||
m_scriptTimer.Elapsed += new ElapsedEventHandler(RunAutoTimerScript);
|
m_scriptTimer.Elapsed += RunAutoTimerScript;
|
||||||
}
|
}
|
||||||
PrintFileToConsole("startuplogo.txt");
|
PrintFileToConsole("startuplogo.txt");
|
||||||
}
|
}
|
||||||
|
@ -156,7 +155,7 @@ namespace OpenSim
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
StreamReader readFile = File.OpenText(fileName);
|
StreamReader readFile = File.OpenText(fileName);
|
||||||
string currentCommand = String.Empty;
|
string currentCommand;
|
||||||
while ((currentCommand = readFile.ReadLine()) != null)
|
while ((currentCommand = readFile.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
if (currentCommand != String.Empty)
|
if (currentCommand != String.Empty)
|
||||||
|
@ -177,7 +176,7 @@ namespace OpenSim
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
StreamReader readFile = File.OpenText(fileName);
|
StreamReader readFile = File.OpenText(fileName);
|
||||||
string currentLine = String.Empty;
|
string currentLine;
|
||||||
while ((currentLine = readFile.ReadLine()) != null)
|
while ((currentLine = readFile.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
m_log.Info("[!]" + currentLine);
|
m_log.Info("[!]" + currentLine);
|
||||||
|
@ -609,55 +608,6 @@ namespace OpenSim
|
||||||
m_assetCache.ShowState();
|
m_assetCache.ShowState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "users":
|
|
||||||
IList agents = m_sceneManager.GetCurrentSceneAvatars();
|
|
||||||
|
|
||||||
m_console.Notice(String.Format("\nAgents connected: {0}\n", agents.Count));
|
|
||||||
|
|
||||||
m_console.Notice(
|
|
||||||
String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}{6,-15}", "Firstname", "Lastname",
|
|
||||||
"Agent ID", "Circuit", "IP", "Region", "Status"));
|
|
||||||
|
|
||||||
foreach (ScenePresence presence in agents)
|
|
||||||
{
|
|
||||||
RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle);
|
|
||||||
string regionName;
|
|
||||||
EndPoint ep = null;
|
|
||||||
|
|
||||||
if (regionInfo == null)
|
|
||||||
{
|
|
||||||
regionName = "Unresolvable";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
regionName = regionInfo.RegionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < m_udpServers.Count; i++)
|
|
||||||
{
|
|
||||||
if (m_udpServers[i].RegionHandle == presence.RegionHandle)
|
|
||||||
{
|
|
||||||
|
|
||||||
m_udpServers[i].clientCircuits_reverse.TryGetValue(presence.ControllingClient.CircuitCode, out ep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_console.Notice(
|
|
||||||
String.Format(
|
|
||||||
"{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}{6,-15}",
|
|
||||||
presence.Firstname,
|
|
||||||
presence.Lastname,
|
|
||||||
presence.UUID,
|
|
||||||
presence.ControllingClient.CircuitCode,
|
|
||||||
ep,
|
|
||||||
regionName,
|
|
||||||
((((ClientView)presence.ControllingClient).PacketProcessingEnabled)
|
|
||||||
?"Active client":"Standby client")));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_console.Notice("");
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "modules":
|
case "modules":
|
||||||
m_console.Notice("The currently loaded shared modules are:");
|
m_console.Notice("The currently loaded shared modules are:");
|
||||||
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
|
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.ClientStack
|
||||||
|
{
|
||||||
|
public interface IClientNetworkServer
|
||||||
|
{
|
||||||
|
Socket Server { get; }
|
||||||
|
bool HandlesRegion(Location x);
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,12 +27,12 @@
|
||||||
|
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
public interface ClientStackNetworkHandler
|
public interface LLClientStackNetworkHandler
|
||||||
{
|
{
|
||||||
void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender);
|
void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender);
|
||||||
void RemoveClientCircuit(uint circuitcode);
|
void RemoveClientCircuit(uint circuitcode);
|
||||||
void RegisterPacketServer(PacketServer server);
|
void RegisterPacketServer(LLPacketServer server);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -39,10 +39,11 @@ using libsecondlife.Packets;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
using OpenSim.Region.ClientStack.LindenUDP;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using Timer=System.Timers.Timer;
|
using Timer=System.Timers.Timer;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
|
public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
/// Handles new client connections
|
/// Handles new client connections
|
||||||
/// Constructor takes a single Packet and authenticates everything
|
/// Constructor takes a single Packet and authenticates everything
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ClientView : IClientAPI
|
public class LLClientView : IClientAPI
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
protected IScene m_scene;
|
protected IScene m_scene;
|
||||||
protected AgentCircuitManager m_authenticateSessionsHandler;
|
protected AgentCircuitManager m_authenticateSessionsHandler;
|
||||||
|
|
||||||
protected PacketQueue m_packetQueue;
|
protected LLPacketQueue m_packetQueue;
|
||||||
|
|
||||||
protected Dictionary<uint, uint> m_pendingAcks = new Dictionary<uint, uint>();
|
protected Dictionary<uint, uint> m_pendingAcks = new Dictionary<uint, uint>();
|
||||||
protected Dictionary<uint, Packet> m_needAck = new Dictionary<uint, Packet>();
|
protected Dictionary<uint, Packet> m_needAck = new Dictionary<uint, Packet>();
|
||||||
|
@ -116,7 +117,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
protected const int MAX_APPENDED_ACKS = 10;
|
protected const int MAX_APPENDED_ACKS = 10;
|
||||||
protected const int RESEND_TIMEOUT = 4000;
|
protected const int RESEND_TIMEOUT = 4000;
|
||||||
protected const int MAX_SEQUENCE = 0xFFFFFF;
|
protected const int MAX_SEQUENCE = 0xFFFFFF;
|
||||||
protected PacketServer m_networkServer;
|
protected LLPacketServer m_networkServer;
|
||||||
|
|
||||||
/* public variables */
|
/* public variables */
|
||||||
protected string m_firstName;
|
protected string m_firstName;
|
||||||
|
@ -317,7 +318,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
/* METHODS */
|
/* METHODS */
|
||||||
|
|
||||||
public ClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, PacketServer packServer,
|
public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer,
|
||||||
AgentCircuitManager authenSessions, LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP)
|
AgentCircuitManager authenSessions, LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP)
|
||||||
{
|
{
|
||||||
m_moneyBalance = 1000;
|
m_moneyBalance = 1000;
|
||||||
|
@ -347,7 +348,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
// in it to process. It's an on-purpose threadlock though because
|
// in it to process. It's an on-purpose threadlock though because
|
||||||
// without it, the clientloop will suck up all sim resources.
|
// without it, the clientloop will suck up all sim resources.
|
||||||
|
|
||||||
m_packetQueue = new PacketQueue(agentId);
|
m_packetQueue = new LLPacketQueue(agentId);
|
||||||
|
|
||||||
RegisterLocalPacketHandlers();
|
RegisterLocalPacketHandlers();
|
||||||
|
|
||||||
|
@ -569,7 +570,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
m_log.Info("[CLIENT]: Entered loop");
|
m_log.Info("[CLIENT]: Entered loop");
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
QueItem nextPacket = m_packetQueue.Dequeue();
|
LLQueItem nextPacket = m_packetQueue.Dequeue();
|
||||||
if (nextPacket == null)
|
if (nextPacket == null)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -966,7 +967,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
patches[2] = x + 2 + y * 16;
|
patches[2] = x + 2 + y * 16;
|
||||||
patches[3] = x + 3 + y * 16;
|
patches[3] = x + 3 + y * 16;
|
||||||
|
|
||||||
Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
|
Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
|
||||||
OutPacket(layerpack, ThrottleOutPacketType.Land);
|
OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -995,7 +996,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
patches[0] = patchx + 0 + patchy * 16;
|
patches[0] = patchx + 0 + patchy * 16;
|
||||||
|
|
||||||
Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
|
Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
|
||||||
OutPacket(layerpack, ThrottleOutPacketType.Land);
|
OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -3036,7 +3037,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QueItem item = new QueItem();
|
LLQueItem item = new LLQueItem();
|
||||||
item.Packet = NewPack;
|
item.Packet = NewPack;
|
||||||
item.Incoming = true;
|
item.Incoming = true;
|
||||||
m_packetQueue.Enqueue(item);
|
m_packetQueue.Enqueue(item);
|
||||||
|
@ -3046,7 +3047,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType)
|
public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType)
|
||||||
{
|
{
|
||||||
if ((SynchronizeClient != null) && (!PacketProcessingEnabled))
|
if ((SynchronizeClient != null) && (!IsActive))
|
||||||
{
|
{
|
||||||
// Sending packet to active client's server.
|
// Sending packet to active client's server.
|
||||||
if (SynchronizeClient(m_scene, NewPack, m_agentId, throttlePacketType))
|
if (SynchronizeClient(m_scene, NewPack, m_agentId, throttlePacketType))
|
||||||
|
@ -3055,7 +3056,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QueItem item = new QueItem();
|
LLQueItem item = new LLQueItem();
|
||||||
item.Packet = NewPack;
|
item.Packet = NewPack;
|
||||||
item.Incoming = false;
|
item.Incoming = false;
|
||||||
item.throttleType = throttlePacketType; // Packet throttle type
|
item.throttleType = throttlePacketType; // Packet throttle type
|
||||||
|
@ -3184,7 +3185,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
private bool m_packetProcessingEnabled = true;
|
private bool m_packetProcessingEnabled = true;
|
||||||
|
|
||||||
public bool PacketProcessingEnabled {
|
public bool IsActive {
|
||||||
get { return m_packetProcessingEnabled; }
|
get { return m_packetProcessingEnabled; }
|
||||||
set { m_packetProcessingEnabled = value; }
|
set { m_packetProcessingEnabled = value; }
|
||||||
}
|
}
|
|
@ -36,25 +36,25 @@ using OpenSim.Framework.Statistics;
|
||||||
using OpenSim.Framework.Statistics.Interfaces;
|
using OpenSim.Framework.Statistics.Interfaces;
|
||||||
using Timer=System.Timers.Timer;
|
using Timer=System.Timers.Timer;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
public class PacketQueue : IPullStatsProvider
|
public class LLPacketQueue : IPullStatsProvider
|
||||||
{
|
{
|
||||||
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool m_enabled = true;
|
private bool m_enabled = true;
|
||||||
|
|
||||||
private BlockingQueue<QueItem> SendQueue;
|
private BlockingQueue<LLQueItem> SendQueue;
|
||||||
|
|
||||||
private Queue<QueItem> IncomingPacketQueue;
|
private Queue<LLQueItem> IncomingPacketQueue;
|
||||||
private Queue<QueItem> OutgoingPacketQueue;
|
private Queue<LLQueItem> OutgoingPacketQueue;
|
||||||
private Queue<QueItem> ResendOutgoingPacketQueue;
|
private Queue<LLQueItem> ResendOutgoingPacketQueue;
|
||||||
private Queue<QueItem> LandOutgoingPacketQueue;
|
private Queue<LLQueItem> LandOutgoingPacketQueue;
|
||||||
private Queue<QueItem> WindOutgoingPacketQueue;
|
private Queue<LLQueItem> WindOutgoingPacketQueue;
|
||||||
private Queue<QueItem> CloudOutgoingPacketQueue;
|
private Queue<LLQueItem> CloudOutgoingPacketQueue;
|
||||||
private Queue<QueItem> TaskOutgoingPacketQueue;
|
private Queue<LLQueItem> TaskOutgoingPacketQueue;
|
||||||
private Queue<QueItem> TextureOutgoingPacketQueue;
|
private Queue<LLQueItem> TextureOutgoingPacketQueue;
|
||||||
private Queue<QueItem> AssetOutgoingPacketQueue;
|
private Queue<LLQueItem> AssetOutgoingPacketQueue;
|
||||||
|
|
||||||
private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
|
private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
|
||||||
private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
|
private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
|
||||||
|
@ -67,14 +67,14 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
private int throttletimems = 1000;
|
private int throttletimems = 1000;
|
||||||
|
|
||||||
private PacketThrottle ResendThrottle;
|
private LLPacketThrottle ResendThrottle;
|
||||||
private PacketThrottle LandThrottle;
|
private LLPacketThrottle LandThrottle;
|
||||||
private PacketThrottle WindThrottle;
|
private LLPacketThrottle WindThrottle;
|
||||||
private PacketThrottle CloudThrottle;
|
private LLPacketThrottle CloudThrottle;
|
||||||
private PacketThrottle TaskThrottle;
|
private LLPacketThrottle TaskThrottle;
|
||||||
private PacketThrottle AssetThrottle;
|
private LLPacketThrottle AssetThrottle;
|
||||||
private PacketThrottle TextureThrottle;
|
private LLPacketThrottle TextureThrottle;
|
||||||
private PacketThrottle TotalThrottle;
|
private LLPacketThrottle TotalThrottle;
|
||||||
|
|
||||||
// private long LastThrottle;
|
// private long LastThrottle;
|
||||||
// private long ThrottleInterval;
|
// private long ThrottleInterval;
|
||||||
|
@ -82,37 +82,37 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
private LLUUID m_agentId;
|
private LLUUID m_agentId;
|
||||||
|
|
||||||
public PacketQueue(LLUUID agentId)
|
public LLPacketQueue(LLUUID agentId)
|
||||||
{
|
{
|
||||||
// While working on this, the BlockingQueue had me fooled for a bit.
|
// While working on this, the BlockingQueue had me fooled for a bit.
|
||||||
// The Blocking queue causes the thread to stop until there's something
|
// The Blocking queue causes the thread to stop until there's something
|
||||||
// in it to process. it's an on-purpose threadlock though because
|
// in it to process. it's an on-purpose threadlock though because
|
||||||
// without it, the clientloop will suck up all sim resources.
|
// without it, the clientloop will suck up all sim resources.
|
||||||
|
|
||||||
SendQueue = new BlockingQueue<QueItem>();
|
SendQueue = new BlockingQueue<LLQueItem>();
|
||||||
|
|
||||||
IncomingPacketQueue = new Queue<QueItem>();
|
IncomingPacketQueue = new Queue<LLQueItem>();
|
||||||
OutgoingPacketQueue = new Queue<QueItem>();
|
OutgoingPacketQueue = new Queue<LLQueItem>();
|
||||||
ResendOutgoingPacketQueue = new Queue<QueItem>();
|
ResendOutgoingPacketQueue = new Queue<LLQueItem>();
|
||||||
LandOutgoingPacketQueue = new Queue<QueItem>();
|
LandOutgoingPacketQueue = new Queue<LLQueItem>();
|
||||||
WindOutgoingPacketQueue = new Queue<QueItem>();
|
WindOutgoingPacketQueue = new Queue<LLQueItem>();
|
||||||
CloudOutgoingPacketQueue = new Queue<QueItem>();
|
CloudOutgoingPacketQueue = new Queue<LLQueItem>();
|
||||||
TaskOutgoingPacketQueue = new Queue<QueItem>();
|
TaskOutgoingPacketQueue = new Queue<LLQueItem>();
|
||||||
TextureOutgoingPacketQueue = new Queue<QueItem>();
|
TextureOutgoingPacketQueue = new Queue<LLQueItem>();
|
||||||
AssetOutgoingPacketQueue = new Queue<QueItem>();
|
AssetOutgoingPacketQueue = new Queue<LLQueItem>();
|
||||||
|
|
||||||
|
|
||||||
// Set up the throttle classes (min, max, current) in bytes
|
// Set up the throttle classes (min, max, current) in bytes
|
||||||
ResendThrottle = new PacketThrottle(5000, 100000, 16000);
|
ResendThrottle = new LLPacketThrottle(5000, 100000, 16000);
|
||||||
LandThrottle = new PacketThrottle(1000, 100000, 2000);
|
LandThrottle = new LLPacketThrottle(1000, 100000, 2000);
|
||||||
WindThrottle = new PacketThrottle(1000, 100000, 1000);
|
WindThrottle = new LLPacketThrottle(1000, 100000, 1000);
|
||||||
CloudThrottle = new PacketThrottle(1000, 100000, 1000);
|
CloudThrottle = new LLPacketThrottle(1000, 100000, 1000);
|
||||||
TaskThrottle = new PacketThrottle(1000, 800000, 3000);
|
TaskThrottle = new LLPacketThrottle(1000, 800000, 3000);
|
||||||
AssetThrottle = new PacketThrottle(1000, 800000, 1000);
|
AssetThrottle = new LLPacketThrottle(1000, 800000, 1000);
|
||||||
TextureThrottle = new PacketThrottle(1000, 800000, 4000);
|
TextureThrottle = new LLPacketThrottle(1000, 800000, 4000);
|
||||||
// Total Throttle trumps all
|
// Total Throttle trumps all
|
||||||
// Number of bytes allowed to go out per second. (256kbps per client)
|
// Number of bytes allowed to go out per second. (256kbps per client)
|
||||||
TotalThrottle = new PacketThrottle(0, 1500000, 28000);
|
TotalThrottle = new LLPacketThrottle(0, 1500000, 28000);
|
||||||
|
|
||||||
throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor));
|
throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor));
|
||||||
throttleTimer.Elapsed += new ElapsedEventHandler(ThrottleTimerElapsed);
|
throttleTimer.Elapsed += new ElapsedEventHandler(ThrottleTimerElapsed);
|
||||||
|
@ -133,7 +133,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
/* STANDARD QUEUE MANIPULATION INTERFACES */
|
/* STANDARD QUEUE MANIPULATION INTERFACES */
|
||||||
|
|
||||||
|
|
||||||
public void Enqueue(QueItem item)
|
public void Enqueue(LLQueItem item)
|
||||||
{
|
{
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
{
|
{
|
||||||
|
@ -182,7 +182,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueItem Dequeue()
|
public LLQueItem Dequeue()
|
||||||
{
|
{
|
||||||
return SendQueue.Dequeue();
|
return SendQueue.Dequeue();
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
//Now comes the fun part.. we dump all our elements into m_packetQueue that we've saved up.
|
//Now comes the fun part.. we dump all our elements into m_packetQueue that we've saved up.
|
||||||
if (ResendThrottle.UnderLimit() && ResendOutgoingPacketQueue.Count > 0)
|
if (ResendThrottle.UnderLimit() && ResendOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = ResendOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -295,7 +295,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0)
|
if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = LandOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = LandOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -303,7 +303,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0)
|
if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = WindOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = WindOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -311,7 +311,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0)
|
if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = CloudOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = CloudOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -319,7 +319,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0)
|
if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = TaskOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = TaskOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0)
|
if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = TextureOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -335,7 +335,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0)
|
if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
QueItem qpack = AssetOutgoingPacketQueue.Dequeue();
|
LLQueItem qpack = AssetOutgoingPacketQueue.Dequeue();
|
||||||
|
|
||||||
SendQueue.Enqueue(qpack);
|
SendQueue.Enqueue(qpack);
|
||||||
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
|
||||||
|
@ -353,7 +353,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
ProcessThrottle();
|
ProcessThrottle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThrottleCheck(ref PacketThrottle throttle, ref Queue<QueItem> q, QueItem item)
|
private void ThrottleCheck(ref LLPacketThrottle throttle, ref Queue<LLQueItem> q, LLQueItem item)
|
||||||
{
|
{
|
||||||
// The idea.. is if the packet throttle queues are empty
|
// The idea.. is if the packet throttle queues are empty
|
||||||
// and the client is under throttle for the type. Queue
|
// and the client is under throttle for the type. Queue
|
||||||
|
@ -524,7 +524,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
AssetOutgoingPacketQueue.Count);
|
AssetOutgoingPacketQueue.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueItem[] GetQueueArray()
|
public LLQueItem[] GetQueueArray()
|
||||||
{
|
{
|
||||||
return SendQueue.GetQueueArray();
|
return SendQueue.GetQueueArray();
|
||||||
}
|
}
|
|
@ -31,15 +31,16 @@ using libsecondlife;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
using OpenSim.Region.ClientStack.LindenUDP;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
public class PacketServer
|
public class LLPacketServer
|
||||||
{
|
{
|
||||||
//private static readonly log4net.ILog m_log
|
//private static readonly log4net.ILog m_log
|
||||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private ClientStackNetworkHandler m_networkHandler;
|
private LLClientStackNetworkHandler m_networkHandler;
|
||||||
private IScene m_scene;
|
private IScene m_scene;
|
||||||
|
|
||||||
//private readonly ClientManager m_clientManager = new ClientManager();
|
//private readonly ClientManager m_clientManager = new ClientManager();
|
||||||
|
@ -48,7 +49,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
// get { return m_clientManager; }
|
// get { return m_clientManager; }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public PacketServer(ClientStackNetworkHandler networkHandler)
|
public LLPacketServer(LLClientStackNetworkHandler networkHandler)
|
||||||
{
|
{
|
||||||
m_networkHandler = networkHandler;
|
m_networkHandler = networkHandler;
|
||||||
m_networkHandler.RegisterPacketServer(this);
|
m_networkHandler.RegisterPacketServer(this);
|
||||||
|
@ -71,11 +72,11 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
|
protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
|
||||||
ClientManager clientManager, IScene scene, AssetCache assetCache,
|
ClientManager clientManager, IScene scene, AssetCache assetCache,
|
||||||
PacketServer packServer, AgentCircuitManager authenSessions,
|
LLPacketServer packServer, AgentCircuitManager authenSessions,
|
||||||
LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP)
|
LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
new ClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP);
|
new LLClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,
|
public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,
|
|
@ -25,9 +25,9 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
public class PacketThrottle
|
public class LLPacketThrottle
|
||||||
{
|
{
|
||||||
private int max; // max allowable throttle
|
private int max; // max allowable throttle
|
||||||
private int min; // min allowable throttle
|
private int min; // min allowable throttle
|
||||||
|
@ -35,7 +35,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
private static int divisor = 7; // the throttle time divisor, this probably should factor out
|
private static int divisor = 7; // the throttle time divisor, this probably should factor out
|
||||||
private int sent; // current number of bytes sent
|
private int sent; // current number of bytes sent
|
||||||
|
|
||||||
public PacketThrottle(int Min, int Max, int Throttle)
|
public LLPacketThrottle(int Min, int Max, int Throttle)
|
||||||
{
|
{
|
||||||
max = Max;
|
max = Max;
|
||||||
min = Min;
|
min = Min;
|
|
@ -28,11 +28,11 @@
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
public class QueItem
|
public class LLQueItem
|
||||||
{
|
{
|
||||||
public QueItem()
|
public LLQueItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,18 @@ using libsecondlife.Packets;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
using OpenSim.Region.ClientStack.LindenUDP;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
public class UDPServer : ClientStackNetworkHandler
|
public class LLUDPServer : LLClientStackNetworkHandler, IClientNetworkServer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
|
protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
|
||||||
public Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>();
|
public Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>();
|
||||||
protected Dictionary<uint, EndPoint> proxyCircuits = new Dictionary<uint, EndPoint>();
|
protected Dictionary<uint, EndPoint> proxyCircuits = new Dictionary<uint, EndPoint>();
|
||||||
public Socket Server;
|
private Socket m_socket;
|
||||||
protected IPEndPoint ServerIncoming;
|
protected IPEndPoint ServerIncoming;
|
||||||
protected byte[] RecvBuffer = new byte[4096];
|
protected byte[] RecvBuffer = new byte[4096];
|
||||||
protected byte[] ZeroBuffer = new byte[8192];
|
protected byte[] ZeroBuffer = new byte[8192];
|
||||||
|
@ -53,8 +54,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
protected EndPoint epProxy;
|
protected EndPoint epProxy;
|
||||||
protected int proxyPortOffset;
|
protected int proxyPortOffset;
|
||||||
protected AsyncCallback ReceivedData;
|
protected AsyncCallback ReceivedData;
|
||||||
protected PacketServer m_packetServer;
|
protected LLPacketServer m_packetServer;
|
||||||
protected ulong m_regionHandle;
|
protected Location m_location;
|
||||||
|
|
||||||
protected uint listenPort;
|
protected uint listenPort;
|
||||||
protected bool Allow_Alternate_Port;
|
protected bool Allow_Alternate_Port;
|
||||||
|
@ -63,7 +64,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
protected AssetCache m_assetCache;
|
protected AssetCache m_assetCache;
|
||||||
protected AgentCircuitManager m_authenticateSessionsClass;
|
protected AgentCircuitManager m_authenticateSessionsClass;
|
||||||
|
|
||||||
public PacketServer PacketServer
|
public LLPacketServer PacketServer
|
||||||
{
|
{
|
||||||
get { return m_packetServer; }
|
get { return m_packetServer; }
|
||||||
set { m_packetServer = value; }
|
set { m_packetServer = value; }
|
||||||
|
@ -75,20 +76,30 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
m_localScene = value;
|
m_localScene = value;
|
||||||
m_packetServer.LocalScene = m_localScene;
|
m_packetServer.LocalScene = m_localScene;
|
||||||
m_regionHandle = m_localScene.RegionInfo.RegionHandle;
|
m_location = new Location(m_localScene.RegionInfo.RegionHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ulong RegionHandle
|
public ulong RegionHandle
|
||||||
{
|
{
|
||||||
get { return m_regionHandle; }
|
get { return m_location.RegionHandle; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public UDPServer()
|
Socket IClientNetworkServer.Server
|
||||||
|
{
|
||||||
|
get { return m_socket; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HandlesRegion(Location x)
|
||||||
|
{
|
||||||
|
return x == m_location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLUDPServer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public UDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
|
public LLUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
|
||||||
{
|
{
|
||||||
this.proxyPortOffset = proxyPortOffset;
|
this.proxyPortOffset = proxyPortOffset;
|
||||||
listenPort = (uint) (port + proxyPortOffset);
|
listenPort = (uint) (port + proxyPortOffset);
|
||||||
|
@ -106,7 +117,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
protected virtual void CreatePacketServer()
|
protected virtual void CreatePacketServer()
|
||||||
{
|
{
|
||||||
PacketServer packetServer = new PacketServer(this);
|
LLPacketServer packetServer = new LLPacketServer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnReceivedData(IAsyncResult result)
|
protected virtual void OnReceivedData(IAsyncResult result)
|
||||||
|
@ -119,7 +130,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
numBytes = Server.EndReceiveFrom(result, ref epSender);
|
numBytes = m_socket.EndReceiveFrom(result, ref epSender);
|
||||||
}
|
}
|
||||||
catch (SocketException e)
|
catch (SocketException e)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +152,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
||||||
ReceivedData, null);
|
ReceivedData, null);
|
||||||
|
|
||||||
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
|
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
|
||||||
|
@ -166,7 +177,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
||||||
ReceivedData, null);
|
ReceivedData, null);
|
||||||
|
|
||||||
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
|
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
|
||||||
|
@ -198,7 +209,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
m_log.Debug("[UDPSERVER]: " + e.ToString());
|
m_log.Debug("[UDPSERVER]: " + e.ToString());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
||||||
ReceivedData, null);
|
ReceivedData, null);
|
||||||
|
|
||||||
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
|
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
|
||||||
|
@ -239,7 +250,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||||
}
|
}
|
||||||
catch (SocketException)
|
catch (SocketException)
|
||||||
{
|
{
|
||||||
|
@ -253,7 +264,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
||||||
ReceivedData, null);
|
ReceivedData, null);
|
||||||
|
|
||||||
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
|
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
|
||||||
|
@ -325,7 +336,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
catch (Exception e3)
|
catch (Exception e3)
|
||||||
{
|
{
|
||||||
m_log.Error("[UDPSERVER]: Adding New Client threw exception " + e3.ToString());
|
m_log.Error("[UDPSERVER]: Adding New Client threw exception " + e3.ToString());
|
||||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
|
||||||
ReceivedData, null);
|
ReceivedData, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,8 +396,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + ".");
|
m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + ".");
|
||||||
|
|
||||||
ServerIncoming = new IPEndPoint(listenIP, (int)newPort);
|
ServerIncoming = new IPEndPoint(listenIP, (int)newPort);
|
||||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
Server.Bind(ServerIncoming);
|
m_socket.Bind(ServerIncoming);
|
||||||
listenPort = newPort;
|
listenPort = newPort;
|
||||||
|
|
||||||
m_log.Info("[SERVER]: UDP socket bound, getting ready to listen");
|
m_log.Info("[SERVER]: UDP socket bound, getting ready to listen");
|
||||||
|
@ -394,12 +405,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
ipeSender = new IPEndPoint(listenIP, 0);
|
ipeSender = new IPEndPoint(listenIP, 0);
|
||||||
epSender = (EndPoint)ipeSender;
|
epSender = (EndPoint)ipeSender;
|
||||||
ReceivedData = new AsyncCallback(OnReceivedData);
|
ReceivedData = new AsyncCallback(OnReceivedData);
|
||||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||||
|
|
||||||
m_log.Info("[SERVER]: Listening on port " + newPort);
|
m_log.Info("[SERVER]: Listening on port " + newPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RegisterPacketServer(PacketServer server)
|
public virtual void RegisterPacketServer(LLPacketServer server)
|
||||||
{
|
{
|
||||||
m_packetServer = server;
|
m_packetServer = server;
|
||||||
}
|
}
|
||||||
|
@ -418,12 +429,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
//MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString());
|
//MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString());
|
||||||
PacketPool.EncodeProxyMessage(buffer, ref size, sendto);
|
PacketPool.EncodeProxyMessage(buffer, ref size, sendto);
|
||||||
Server.SendTo(buffer, size, flags, proxyCircuits[circuitcode]);
|
m_socket.SendTo(buffer, size, flags, proxyCircuits[circuitcode]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString());
|
//MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString());
|
||||||
Server.SendTo(buffer, size, flags, sendto);
|
m_socket.SendTo(buffer, size, flags, sendto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,12 +34,11 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
using OpenSim.Region.ClientStack.LindenUDP;
|
||||||
using OpenSim.Region.Environment;
|
using OpenSim.Region.Environment;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
//using OpenSim.Framework.Console;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack
|
namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
public abstract class RegionApplicationBase : BaseOpenSimServer
|
public abstract class RegionApplicationBase : BaseOpenSimServer
|
||||||
|
@ -75,7 +74,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
public virtual void StartUp()
|
public virtual void StartUp()
|
||||||
{
|
{
|
||||||
ClientView.TerrainManager = new TerrainManager(new SecondLife());
|
LLClientView.TerrainManager = new TerrainManager(new SecondLife());
|
||||||
|
|
||||||
m_storageManager = CreateStorageManager(m_storageConnectionString);
|
m_storageManager = CreateStorageManager(m_storageConnectionString);
|
||||||
|
|
||||||
|
@ -108,12 +107,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
return physicsPluginManager.GetPhysicsScene(engine, meshEngine);
|
return physicsPluginManager.GetPhysicsScene(engine, meshEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer, bool m_permissions)
|
protected Scene SetupScene(RegionInfo regionInfo, out LLUDPServer udpServer, bool m_permissions)
|
||||||
{
|
{
|
||||||
return SetupScene(regionInfo, 0, out udpServer, m_permissions);
|
return SetupScene(regionInfo, 0, out udpServer, m_permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out UDPServer udpServer, bool m_permissions)
|
protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out LLUDPServer udpServer, bool m_permissions)
|
||||||
{
|
{
|
||||||
AgentCircuitManager circuitManager = new AgentCircuitManager();
|
AgentCircuitManager circuitManager = new AgentCircuitManager();
|
||||||
IPAddress listenIP = regionInfo.InternalEndPoint.Address;
|
IPAddress listenIP = regionInfo.InternalEndPoint.Address;
|
||||||
|
@ -121,7 +120,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
// listenIP = IPAddress.Parse("0.0.0.0");
|
// listenIP = IPAddress.Parse("0.0.0.0");
|
||||||
|
|
||||||
uint port = (uint) regionInfo.InternalEndPoint.Port;
|
uint port = (uint) regionInfo.InternalEndPoint.Port;
|
||||||
udpServer = new UDPServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager);
|
udpServer = new LLUDPServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager);
|
||||||
regionInfo.InternalEndPoint.Port = (int)port;
|
regionInfo.InternalEndPoint.Port = (int)port;
|
||||||
|
|
||||||
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
|
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
|
||||||
|
|
|
@ -11,5 +11,6 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
|
||||||
T[] RequestInterface<T>();
|
T[] RequestInterface<T>();
|
||||||
Location GetLocationByDirection(Scene scene, InterregionModule.Direction dir);
|
Location GetLocationByDirection(Scene scene, InterregionModule.Direction dir);
|
||||||
void internal_CreateRemotingObjects();
|
void internal_CreateRemotingObjects();
|
||||||
|
void RegisterRemoteRegion(string uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,14 +29,14 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>();
|
private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>();
|
||||||
|
private readonly Object m_lockObject = new object();
|
||||||
private readonly List<Location> m_myLocations = new List<Location>();
|
private readonly List<Location> m_myLocations = new List<Location>();
|
||||||
|
|
||||||
private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
|
private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
|
||||||
private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
|
private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
|
||||||
private IConfigSource m_config;
|
private IConfigSource m_config;
|
||||||
private bool m_enabled = false;
|
private const bool m_enabled = false;
|
||||||
|
|
||||||
private Object m_lockObject = new object();
|
|
||||||
private RemotingObject m_myRemote;
|
private RemotingObject m_myRemote;
|
||||||
private TcpChannel m_tcpChannel;
|
private TcpChannel m_tcpChannel;
|
||||||
private int m_tcpPort = 10101;
|
private int m_tcpPort = 10101;
|
||||||
|
@ -81,11 +81,8 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
|
||||||
{
|
{
|
||||||
return m_neighbourRemote[loc].RequestInterface<T>();
|
return m_neighbourRemote[loc].RequestInterface<T>();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IndexOutOfRangeException("No neighbour availible at that location");
|
throw new IndexOutOfRangeException("No neighbour availible at that location");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public T[] RequestInterface<T>()
|
public T[] RequestInterface<T>()
|
||||||
{
|
{
|
||||||
|
@ -108,15 +105,16 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
|
||||||
return new Location(0, 0);
|
return new Location(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
public void RegisterRemoteRegion(string uri)
|
||||||
|
{
|
||||||
|
RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
|
#endregion
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region IRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
|
||||||
if (m_enabled)
|
|
||||||
{
|
{
|
||||||
m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
|
m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
|
||||||
(int) scene.RegionInfo.RegionLocY));
|
(int) scene.RegionInfo.RegionLocY));
|
||||||
|
@ -124,9 +122,7 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IInterregionModule>(this);
|
scene.RegisterModuleInterface<IInterregionModule>(this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
if (m_enabled)
|
if (m_enabled)
|
||||||
|
@ -160,11 +156,6 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void RegisterRemoteRegion(string uri)
|
|
||||||
{
|
|
||||||
RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RegisterRemotingInterface(RemotingObject remote)
|
private void RegisterRemotingInterface(RemotingObject remote)
|
||||||
{
|
{
|
||||||
Location[] locs = remote.GetLocations();
|
Location[] locs = remote.GetLocations();
|
||||||
|
|
|
@ -224,6 +224,12 @@ namespace OpenSim.Region.Examples.SimpleModule
|
||||||
get { return FirstName + LastName; }
|
get { return FirstName + LastName; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsActive
|
||||||
|
{
|
||||||
|
get { return true; }
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
public virtual int NextAnimationSequenceNumber
|
public virtual int NextAnimationSequenceNumber
|
||||||
{
|
{
|
||||||
get { return 1; }
|
get { return 1; }
|
||||||
|
|
Loading…
Reference in New Issue