diff options
author | KittoFlora | 2009-11-02 21:53:51 +0100 |
---|---|---|
committer | KittoFlora | 2009-11-02 21:53:51 +0100 |
commit | 2ec022cf133534bbed4ca5e73fdb1d5a5a40bb3a (patch) | |
tree | e44fc76f1cb7154ecbdfa6e36f961fdc5be311c3 /OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |
parent | Merge branch 'master' into vehicles (diff) | |
parent | Removing Console.WriteLine()s that were brought in with the revert (diff) | |
download | opensim-SC_OLD-2ec022cf133534bbed4ca5e73fdb1d5a5a40bb3a.zip opensim-SC_OLD-2ec022cf133534bbed4ca5e73fdb1d5a5a40bb3a.tar.gz opensim-SC_OLD-2ec022cf133534bbed4ca5e73fdb1d5a5a40bb3a.tar.bz2 opensim-SC_OLD-2ec022cf133534bbed4ca5e73fdb1d5a5a40bb3a.tar.xz |
Merge branch 'master' into vehicles
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 74d3262..93946ae 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -118,13 +118,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
118 | /// <summary></summary> | 118 | /// <summary></summary> |
119 | //private UDPClientCollection m_clients = new UDPClientCollection(); | 119 | //private UDPClientCollection m_clients = new UDPClientCollection(); |
120 | /// <summary>Bandwidth throttle for this UDP server</summary> | 120 | /// <summary>Bandwidth throttle for this UDP server</summary> |
121 | private TokenBucket m_throttle; | 121 | protected TokenBucket m_throttle; |
122 | /// <summary>Bandwidth throttle rates for this UDP server</summary> | 122 | /// <summary>Bandwidth throttle rates for this UDP server</summary> |
123 | private ThrottleRates m_throttleRates; | 123 | protected ThrottleRates m_throttleRates; |
124 | /// <summary>Manages authentication for agent circuits</summary> | 124 | /// <summary>Manages authentication for agent circuits</summary> |
125 | private AgentCircuitManager m_circuitManager; | 125 | private AgentCircuitManager m_circuitManager; |
126 | /// <summary>Reference to the scene this UDP server is attached to</summary> | 126 | /// <summary>Reference to the scene this UDP server is attached to</summary> |
127 | private Scene m_scene; | 127 | protected Scene m_scene; |
128 | /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary> | 128 | /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary> |
129 | private Location m_location; | 129 | private Location m_location; |
130 | /// <summary>The size of the receive buffer for the UDP socket. This value | 130 | /// <summary>The size of the receive buffer for the UDP socket. This value |
@@ -153,6 +153,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
153 | /// <summary>Flag to signal when clients should send pings</summary> | 153 | /// <summary>Flag to signal when clients should send pings</summary> |
154 | private bool m_sendPing; | 154 | private bool m_sendPing; |
155 | 155 | ||
156 | private int m_defaultRTO = 0; | ||
157 | private int m_maxRTO = 0; | ||
158 | |||
156 | public Socket Server { get { return null; } } | 159 | public Socket Server { get { return null; } } |
157 | 160 | ||
158 | public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) | 161 | public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) |
@@ -189,6 +192,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
189 | AvatarTerseUpdatesPerPacket = config.GetInt("AvatarTerseUpdatesPerPacket", 10); | 192 | AvatarTerseUpdatesPerPacket = config.GetInt("AvatarTerseUpdatesPerPacket", 10); |
190 | PrimFullUpdatesPerPacket = config.GetInt("PrimFullUpdatesPerPacket", 100); | 193 | PrimFullUpdatesPerPacket = config.GetInt("PrimFullUpdatesPerPacket", 100); |
191 | TextureSendLimit = config.GetInt("TextureSendLimit", 20); | 194 | TextureSendLimit = config.GetInt("TextureSendLimit", 20); |
195 | |||
196 | m_defaultRTO = config.GetInt("DefaultRTO", 0); | ||
197 | m_maxRTO = config.GetInt("MaxRTO", 0); | ||
192 | } | 198 | } |
193 | else | 199 | else |
194 | { | 200 | { |
@@ -247,8 +253,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
247 | 253 | ||
248 | public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting) | 254 | public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting) |
249 | { | 255 | { |
250 | // CoarseLocationUpdate packets cannot be split in an automated way | 256 | // CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way |
251 | if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting) | 257 | if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting) |
252 | allowSplitting = false; | 258 | allowSplitting = false; |
253 | 259 | ||
254 | if (allowSplitting && packet.HasVariableBlocks) | 260 | if (allowSplitting && packet.HasVariableBlocks) |
@@ -256,8 +262,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
256 | byte[][] datas = packet.ToBytesMultiple(); | 262 | byte[][] datas = packet.ToBytesMultiple(); |
257 | int packetCount = datas.Length; | 263 | int packetCount = datas.Length; |
258 | 264 | ||
259 | //if (packetCount > 1) | 265 | if (packetCount < 1) |
260 | // m_log.Debug("[LLUDPSERVER]: Split " + packet.Type + " packet into " + packetCount + " packets"); | 266 | m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length); |
261 | 267 | ||
262 | for (int i = 0; i < packetCount; i++) | 268 | for (int i = 0; i < packetCount; i++) |
263 | { | 269 | { |
@@ -295,8 +301,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
295 | byte[][] datas = packet.ToBytesMultiple(); | 301 | byte[][] datas = packet.ToBytesMultiple(); |
296 | int packetCount = datas.Length; | 302 | int packetCount = datas.Length; |
297 | 303 | ||
298 | //if (packetCount > 1) | 304 | if (packetCount < 1) |
299 | // m_log.Debug("[LLUDPSERVER]: Split " + packet.Type + " packet into " + packetCount + " packets"); | 305 | m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length); |
300 | 306 | ||
301 | for (int i = 0; i < packetCount; i++) | 307 | for (int i = 0; i < packetCount; i++) |
302 | { | 308 | { |
@@ -409,6 +415,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
409 | SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false); | 415 | SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false); |
410 | } | 416 | } |
411 | 417 | ||
418 | public void CompletePing(LLUDPClient udpClient, byte pingID) | ||
419 | { | ||
420 | CompletePingCheckPacket completePing = new CompletePingCheckPacket(); | ||
421 | completePing.PingID.PingID = pingID; | ||
422 | SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false); | ||
423 | } | ||
424 | |||
412 | public void ResendUnacked(LLUDPClient udpClient) | 425 | public void ResendUnacked(LLUDPClient udpClient) |
413 | { | 426 | { |
414 | if (!udpClient.IsConnected) | 427 | if (!udpClient.IsConnected) |
@@ -429,7 +442,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
429 | 442 | ||
430 | if (expiredPackets != null) | 443 | if (expiredPackets != null) |
431 | { | 444 | { |
432 | m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO); | 445 | //m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO); |
433 | 446 | ||
434 | // Exponential backoff of the retransmission timeout | 447 | // Exponential backoff of the retransmission timeout |
435 | udpClient.BackoffRTO(); | 448 | udpClient.BackoffRTO(); |
@@ -585,7 +598,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
585 | IClientAPI client; | 598 | IClientAPI client; |
586 | if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) | 599 | if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) |
587 | { | 600 | { |
588 | m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); | 601 | //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); |
589 | return; | 602 | return; |
590 | } | 603 | } |
591 | 604 | ||
@@ -669,10 +682,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
669 | { | 682 | { |
670 | // We don't need to do anything else with ping checks | 683 | // We don't need to do anything else with ping checks |
671 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; | 684 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; |
672 | 685 | CompletePing(udpClient, startPing.PingID.PingID); | |
673 | CompletePingCheckPacket completePing = new CompletePingCheckPacket(); | ||
674 | completePing.PingID.PingID = startPing.PingID.PingID; | ||
675 | SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false); | ||
676 | return; | 686 | return; |
677 | } | 687 | } |
678 | else if (packet.Type == PacketType.CompletePingCheck) | 688 | else if (packet.Type == PacketType.CompletePingCheck) |
@@ -759,10 +769,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
759 | } | 769 | } |
760 | } | 770 | } |
761 | 771 | ||
762 | private void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) | 772 | protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) |
763 | { | 773 | { |
764 | // Create the LLUDPClient | 774 | // Create the LLUDPClient |
765 | LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint); | 775 | LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); |
766 | IClientAPI existingClient; | 776 | IClientAPI existingClient; |
767 | 777 | ||
768 | if (!m_scene.TryGetClient(agentID, out existingClient)) | 778 | if (!m_scene.TryGetClient(agentID, out existingClient)) |
@@ -976,7 +986,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
976 | } | 986 | } |
977 | } | 987 | } |
978 | 988 | ||
979 | private void LogoutHandler(IClientAPI client) | 989 | protected void LogoutHandler(IClientAPI client) |
980 | { | 990 | { |
981 | client.SendLogoutPacket(); | 991 | client.SendLogoutPacket(); |
982 | if (client.IsActive) | 992 | if (client.IsActive) |