From a5b9971fd77c0c4bf70656be7f3e7999f59d9f85 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 9 Oct 2009 01:53:06 -0700
Subject: * Added a lock object for the write functions in
LLUDPClientCollection (immutable != concurrent write safety) * Allow the UDP
server to bind to a user-specified port again * Updated to a newer version of
OpenSimUDPBase that streamlines the code even more. This also reintroduces
the highly concurrent packet handling which needs more testing
---
OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index a6aa048..9aeea9a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// Incoming packets that are awaiting handling
private OpenMetaverse.BlockingQueue packetInbox = new OpenMetaverse.BlockingQueue();
///
- private UDPClientCollection clients = new UDPClientCollection();
+ private UDPClientCollection m_clients = new UDPClientCollection();
/// Bandwidth throttle for this UDP server
private TokenBucket m_throttle;
/// Bandwidth throttle rates for this UDP server
@@ -115,7 +115,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public Socket Server { get { return null; } }
public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
- : base((int)port)
+ : base(listenIP, (int)port)
{
#region Environment.TickCount Measurement
@@ -143,7 +143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public new void Start()
{
if (m_scene == null)
- throw new InvalidOperationException("Cannot LLUDPServer.Start() without an IScene reference");
+ throw new InvalidOperationException("[LLUDPSERVER]: Cannot LLUDPServer.Start() without an IScene reference");
base.Start();
@@ -188,7 +188,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_scene.ClientManager.Remove(udpClient.CircuitCode);
udpClient.ClientAPI.Close(false);
udpClient.Shutdown();
- clients.Remove(udpClient.RemoteEndPoint);
+ m_clients.Remove(udpClient.RemoteEndPoint);
}
public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
@@ -208,7 +208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
for (int i = 0; i < packetCount; i++)
{
byte[] data = datas[i];
- clients.ForEach(
+ m_clients.ForEach(
delegate(LLUDPClient client)
{ SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category); });
}
@@ -216,7 +216,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else
{
byte[] data = packet.ToBytes();
- clients.ForEach(
+ m_clients.ForEach(
delegate(LLUDPClient client)
{ SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category); });
}
@@ -502,7 +502,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// Determine which agent this packet came from
- if (!clients.TryGetValue(address, out client))
+ if (!m_clients.TryGetValue(address, out client))
{
m_log.Warn("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address);
return;
@@ -606,7 +606,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_scene.RegionStatus != RegionStatus.SlaveScene)
{
AuthenticateResponse sessionInfo;
- bool isNewCircuit = !clients.ContainsKey(remoteEndPoint);
+ bool isNewCircuit = !m_clients.ContainsKey(remoteEndPoint);
if (!IsClientAuthorized(useCircuitCode, out sessionInfo))
{
@@ -648,7 +648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
udpClient.ClientAPI = clientApi;
// Add the new client to our list of tracked clients
- clients.Add(udpClient.RemoteEndPoint, udpClient);
+ m_clients.Add(udpClient.RemoteEndPoint, udpClient);
}
private void AcknowledgePacket(LLUDPClient client, uint ack, int currentTime, bool fromResend)
@@ -726,7 +726,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
elapsed500MS = 0;
}
- clients.ForEach(
+ m_clients.ForEach(
delegate(LLUDPClient client)
{
if (client.DequeueOutgoing())
--
cgit v1.1