aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-09 01:53:06 -0700
committerJohn Hurliman2009-10-09 01:53:06 -0700
commita5b9971fd77c0c4bf70656be7f3e7999f59d9f85 (patch)
tree9c062f865511d9efde455b800c55f9d94b4921b4 /OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
parentSimplified LLUDPClientCollection from three collections down to one. This wil... (diff)
downloadopensim-SC_OLD-a5b9971fd77c0c4bf70656be7f3e7999f59d9f85.zip
opensim-SC_OLD-a5b9971fd77c0c4bf70656be7f3e7999f59d9f85.tar.gz
opensim-SC_OLD-a5b9971fd77c0c4bf70656be7f3e7999f59d9f85.tar.bz2
opensim-SC_OLD-a5b9971fd77c0c4bf70656be7f3e7999f59d9f85.tar.xz
* 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
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs20
1 files changed, 10 insertions, 10 deletions
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
96 /// <summary>Incoming packets that are awaiting handling</summary> 96 /// <summary>Incoming packets that are awaiting handling</summary>
97 private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); 97 private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>();
98 /// <summary></summary> 98 /// <summary></summary>
99 private UDPClientCollection clients = new UDPClientCollection(); 99 private UDPClientCollection m_clients = new UDPClientCollection();
100 /// <summary>Bandwidth throttle for this UDP server</summary> 100 /// <summary>Bandwidth throttle for this UDP server</summary>
101 private TokenBucket m_throttle; 101 private TokenBucket m_throttle;
102 /// <summary>Bandwidth throttle rates for this UDP server</summary> 102 /// <summary>Bandwidth throttle rates for this UDP server</summary>
@@ -115,7 +115,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
115 public Socket Server { get { return null; } } 115 public Socket Server { get { return null; } }
116 116
117 public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) 117 public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
118 : base((int)port) 118 : base(listenIP, (int)port)
119 { 119 {
120 #region Environment.TickCount Measurement 120 #region Environment.TickCount Measurement
121 121
@@ -143,7 +143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
143 public new void Start() 143 public new void Start()
144 { 144 {
145 if (m_scene == null) 145 if (m_scene == null)
146 throw new InvalidOperationException("Cannot LLUDPServer.Start() without an IScene reference"); 146 throw new InvalidOperationException("[LLUDPSERVER]: Cannot LLUDPServer.Start() without an IScene reference");
147 147
148 base.Start(); 148 base.Start();
149 149
@@ -188,7 +188,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
188 m_scene.ClientManager.Remove(udpClient.CircuitCode); 188 m_scene.ClientManager.Remove(udpClient.CircuitCode);
189 udpClient.ClientAPI.Close(false); 189 udpClient.ClientAPI.Close(false);
190 udpClient.Shutdown(); 190 udpClient.Shutdown();
191 clients.Remove(udpClient.RemoteEndPoint); 191 m_clients.Remove(udpClient.RemoteEndPoint);
192 } 192 }
193 193
194 public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting) 194 public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
@@ -208,7 +208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
208 for (int i = 0; i < packetCount; i++) 208 for (int i = 0; i < packetCount; i++)
209 { 209 {
210 byte[] data = datas[i]; 210 byte[] data = datas[i];
211 clients.ForEach( 211 m_clients.ForEach(
212 delegate(LLUDPClient client) 212 delegate(LLUDPClient client)
213 { SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category); }); 213 { SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category); });
214 } 214 }
@@ -216,7 +216,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
216 else 216 else
217 { 217 {
218 byte[] data = packet.ToBytes(); 218 byte[] data = packet.ToBytes();
219 clients.ForEach( 219 m_clients.ForEach(
220 delegate(LLUDPClient client) 220 delegate(LLUDPClient client)
221 { SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category); }); 221 { SendPacketData(client, data, data.Length, packet.Type, packet.Header.Zerocoded, category); });
222 } 222 }
@@ -502,7 +502,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
502 } 502 }
503 503
504 // Determine which agent this packet came from 504 // Determine which agent this packet came from
505 if (!clients.TryGetValue(address, out client)) 505 if (!m_clients.TryGetValue(address, out client))
506 { 506 {
507 m_log.Warn("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address); 507 m_log.Warn("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address);
508 return; 508 return;
@@ -606,7 +606,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
606 if (m_scene.RegionStatus != RegionStatus.SlaveScene) 606 if (m_scene.RegionStatus != RegionStatus.SlaveScene)
607 { 607 {
608 AuthenticateResponse sessionInfo; 608 AuthenticateResponse sessionInfo;
609 bool isNewCircuit = !clients.ContainsKey(remoteEndPoint); 609 bool isNewCircuit = !m_clients.ContainsKey(remoteEndPoint);
610 610
611 if (!IsClientAuthorized(useCircuitCode, out sessionInfo)) 611 if (!IsClientAuthorized(useCircuitCode, out sessionInfo))
612 { 612 {
@@ -648,7 +648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
648 udpClient.ClientAPI = clientApi; 648 udpClient.ClientAPI = clientApi;
649 649
650 // Add the new client to our list of tracked clients 650 // Add the new client to our list of tracked clients
651 clients.Add(udpClient.RemoteEndPoint, udpClient); 651 m_clients.Add(udpClient.RemoteEndPoint, udpClient);
652 } 652 }
653 653
654 private void AcknowledgePacket(LLUDPClient client, uint ack, int currentTime, bool fromResend) 654 private void AcknowledgePacket(LLUDPClient client, uint ack, int currentTime, bool fromResend)
@@ -726,7 +726,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
726 elapsed500MS = 0; 726 elapsed500MS = 0;
727 } 727 }
728 728
729 clients.ForEach( 729 m_clients.ForEach(
730 delegate(LLUDPClient client) 730 delegate(LLUDPClient client)
731 { 731 {
732 if (client.DequeueOutgoing()) 732 if (client.DequeueOutgoing())