aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2015-09-22 18:39:59 +0100
committerUbitUmarov2015-09-22 18:39:59 +0100
commita8dc07ff5c0ba1c09e9a5beaf76f3b078670c74f (patch)
treee3d088abe02e6a6f53cf8e5c412b0402212c7000
parentlast merging of sog m_linkedAvatars into m_sittingAvatars - untested. (diff)
downloadopensim-SC-a8dc07ff5c0ba1c09e9a5beaf76f3b078670c74f.zip
opensim-SC-a8dc07ff5c0ba1c09e9a5beaf76f3b078670c74f.tar.gz
opensim-SC-a8dc07ff5c0ba1c09e9a5beaf76f3b078670c74f.tar.bz2
opensim-SC-a8dc07ff5c0ba1c09e9a5beaf76f3b078670c74f.tar.xz
removed a protocol breaking lludp debug option that no one should try, changed terrain send throotle to be by packets in queue, reduced odds of MTU violation on terrain send (still bad). Most UDP protocol implementations may not mind much, but our code still does
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs23
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs28
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs53
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs29
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs2
5 files changed, 35 insertions, 100 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 7c5aee7..3b0c775 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -1209,8 +1209,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1209 1209
1210 public virtual bool CanSendLayerData() 1210 public virtual bool CanSendLayerData()
1211 { 1211 {
1212 int n = m_udpClient.GetCatBytesInSendQueue(ThrottleOutPacketType.Land); 1212 int n = m_udpClient.GetPacketsQueuedCount(ThrottleOutPacketType.Land);
1213 if ( n > 100000) 1213 if ( n > 256)
1214 return false; 1214 return false;
1215 return true; 1215 return true;
1216 } 1216 }
@@ -1355,15 +1355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1355 { 1355 {
1356 try 1356 try
1357 { 1357 {
1358 /* test code using the terrain compressor in libOpenMetaverse 1358 int PatchesAssumedToFit = 3;
1359 int[] patchInd = new int[1];
1360 patchInd[0] = px + (py * Constants.TerrainPatchSize);
1361 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(terrData.GetFloatsSerialized(), patchInd);
1362 */
1363 // Many, many patches could have been passed to us. Since the patches will be compressed
1364 // into variable sized blocks, we cannot pre-compute how many will fit into one
1365 // packet. While some fancy packing algorithm is possible, 4 seems to always fit.
1366 int PatchesAssumedToFit = 4;
1367 for (int pcnt = 0; pcnt < px.Length; pcnt += PatchesAssumedToFit) 1359 for (int pcnt = 0; pcnt < px.Length; pcnt += PatchesAssumedToFit)
1368 { 1360 {
1369 int remaining = Math.Min(px.Length - pcnt, PatchesAssumedToFit); 1361 int remaining = Math.Min(px.Length - pcnt, PatchesAssumedToFit);
@@ -1377,10 +1369,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1377 LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, xPatches, yPatches); 1369 LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, xPatches, yPatches);
1378 // DebugSendingPatches("SendLayerDataInternal", xPatches, yPatches); 1370 // DebugSendingPatches("SendLayerDataInternal", xPatches, yPatches);
1379 1371
1380 SendTheLayerPacket(layerpack); 1372 OutPacket(layerpack, ThrottleOutPacketType.Land);
1381 } 1373 }
1382 // LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, px, py);
1383
1384 } 1374 }
1385 catch (Exception e) 1375 catch (Exception e)
1386 { 1376 {
@@ -1388,11 +1378,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1388 } 1378 }
1389 } 1379 }
1390 1380
1391 private void SendTheLayerPacket(LayerDataPacket layerpack)
1392 {
1393 OutPacket(layerpack, ThrottleOutPacketType.Land);
1394 }
1395
1396 /// <summary> 1381 /// <summary>
1397 /// Send the wind matrix to the client 1382 /// Send the wind matrix to the client
1398 /// </summary> 1383 /// </summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index 8d4117d..507c07c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -122,11 +122,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
122 /// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary> 122 /// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary>
123 public readonly IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200); 123 public readonly IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200);
124 124
125 /// <summary>
126 /// If true then we take action in response to unacked reliably sent packets such as resending the packet.
127 /// </summary>
128 public bool ProcessUnackedSends { get; set; }
129
130 /// <summary>Packets we have sent that need to be ACKed by the client</summary> 125 /// <summary>Packets we have sent that need to be ACKed by the client</summary>
131 public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); 126 public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection();
132 127
@@ -252,8 +247,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
252 if (maxRTO != 0) 247 if (maxRTO != 0)
253 m_maxRTO = maxRTO; 248 m_maxRTO = maxRTO;
254 249
255 ProcessUnackedSends = true;
256
257 m_burstTime = rates.BrustTime; 250 m_burstTime = rates.BrustTime;
258 float m_burst = rates.ClientMaxRate * m_burstTime; 251 float m_burst = rates.ClientMaxRate * m_burstTime;
259 252
@@ -357,8 +350,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
357 /// <param name="throttleType"></param> 350 /// <param name="throttleType"></param>
358 public int GetPacketsQueuedCount(ThrottleOutPacketType throttleType) 351 public int GetPacketsQueuedCount(ThrottleOutPacketType throttleType)
359 { 352 {
360 if ((int)throttleType > 0) 353 int icat = (int)throttleType;
361 return m_packetOutboxes[(int)throttleType].Count; 354 if (icat > 0 && icat < THROTTLE_CATEGORY_COUNT)
355 return m_packetOutboxes[icat].Count;
362 else 356 else
363 return 0; 357 return 0;
364 } 358 }
@@ -544,21 +538,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
544 538
545 return data; 539 return data;
546 } 540 }
547 541
548 public int GetCatBytesInSendQueue(ThrottleOutPacketType cat)
549 {
550 ;
551 int icat = (int)cat;
552 if (icat > 0 && icat < THROTTLE_CATEGORY_COUNT)
553 {
554 TokenBucket bucket = m_throttleCategories[icat];
555 return m_packetOutboxes[icat].Count;
556 }
557 else
558 return 0;
559 }
560
561
562 public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS) 542 public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS)
563 { 543 {
564 int icat = (int)cat; 544 int icat = (int)cat;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index b5bdd46..8f345e7 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -991,8 +991,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
991 bufferSize = dataLength; 991 bufferSize = dataLength;
992 buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize); 992 buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize);
993 993
994 // m_log.Error("[LLUDPSERVER]: Packet exceeded buffer size! This could be an indication of packet assembly not obeying the MTU. Type=" + 994 m_log.Error("[LLUDPSERVER]: Packet exceeded buffer size! This could be an indication of packet assembly not obeying the MTU. Type=" +
995 // type + ", DataLength=" + dataLength + ", BufferLength=" + buffer.Data.Length + ". Dropping packet"); 995 type + ", DataLength=" + dataLength + ", BufferLength=" + buffer.Data.Length);
996 Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength); 996 Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength);
997 } 997 }
998 } 998 }
@@ -1200,7 +1200,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1200 Utils.UIntToBytesBig(sequenceNumber, buffer.Data, 1); 1200 Utils.UIntToBytesBig(sequenceNumber, buffer.Data, 1);
1201 outgoingPacket.SequenceNumber = sequenceNumber; 1201 outgoingPacket.SequenceNumber = sequenceNumber;
1202 1202
1203 if (udpClient.ProcessUnackedSends && isReliable) 1203 if (isReliable)
1204 { 1204 {
1205 // Add this packet to the list of ACK responses we are waiting on from the server 1205 // Add this packet to the list of ACK responses we are waiting on from the server
1206 udpClient.NeedAcks.Add(outgoingPacket); 1206 udpClient.NeedAcks.Add(outgoingPacket);
@@ -1418,37 +1418,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1418 1418
1419 #region ACK Receiving 1419 #region ACK Receiving
1420 1420
1421 if (udpClient.ProcessUnackedSends) 1421 // Handle appended ACKs
1422 if (packet.Header.AppendedAcks && packet.Header.AckList != null)
1422 { 1423 {
1423 // Handle appended ACKs 1424 // m_log.DebugFormat(
1424 if (packet.Header.AppendedAcks && packet.Header.AckList != null) 1425 // "[LLUDPSERVER]: Handling {0} appended acks from {1} in {2}",
1425 { 1426 // packet.Header.AckList.Length, client.Name, m_scene.Name);
1426 // m_log.DebugFormat(
1427 // "[LLUDPSERVER]: Handling {0} appended acks from {1} in {2}",
1428 // packet.Header.AckList.Length, client.Name, m_scene.Name);
1429 1427
1430 for (int i = 0; i < packet.Header.AckList.Length; i++) 1428 for (int i = 0; i < packet.Header.AckList.Length; i++)
1431 udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent); 1429 udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent);
1432 } 1430 }
1433 1431
1434 // Handle PacketAck packets 1432 // Handle PacketAck packets
1435 if (packet.Type == PacketType.PacketAck) 1433 if (packet.Type == PacketType.PacketAck)
1436 { 1434 {
1437 PacketAckPacket ackPacket = (PacketAckPacket)packet; 1435 PacketAckPacket ackPacket = (PacketAckPacket)packet;
1438 1436
1439 // m_log.DebugFormat( 1437 // m_log.DebugFormat(
1440 // "[LLUDPSERVER]: Handling {0} packet acks for {1} in {2}", 1438 // "[LLUDPSERVER]: Handling {0} packet acks for {1} in {2}",
1441 // ackPacket.Packets.Length, client.Name, m_scene.Name); 1439 // ackPacket.Packets.Length, client.Name, m_scene.Name);
1442 1440
1443 for (int i = 0; i < ackPacket.Packets.Length; i++) 1441 for (int i = 0; i < ackPacket.Packets.Length; i++)
1444 udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent); 1442 udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent);
1445 1443
1446 // We don't need to do anything else with PacketAck packets 1444 // We don't need to do anything else with PacketAck packets
1447 return;
1448 }
1449 }
1450 else if (packet.Type == PacketType.PacketAck)
1451 {
1452 return; 1445 return;
1453 } 1446 }
1454 1447
@@ -1510,7 +1503,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1510 #endregion BinaryStats 1503 #endregion BinaryStats
1511 1504
1512 1505
1513//Ubit AgentUpdate mess removed from here 1506//AgentUpdate removed from here
1514 1507
1515 1508
1516 #region Ping Check Handling 1509 #region Ping Check Handling
@@ -2168,7 +2161,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2168 2161
2169 if (udpClient.IsConnected) 2162 if (udpClient.IsConnected)
2170 { 2163 {
2171 if (udpClient.ProcessUnackedSends && m_resendUnacked) 2164 if (m_resendUnacked)
2172 HandleUnacked(llClient); 2165 HandleUnacked(llClient);
2173 2166
2174 if (m_sendAcks) 2167 if (m_sendAcks)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
index 3dab5d2..6e6a2d1 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
@@ -558,6 +558,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
558 m_console.OutputFormat("{0} set to {1} in {2}", param, rawValue, m_udpServer.Scene.Name); 558 m_console.OutputFormat("{0} set to {1} in {2}", param, rawValue, m_udpServer.Scene.Name);
559 } 559 }
560 560
561/* not in use, nothing to set/get from lludp
561 private void HandleClientGetCommand(string module, string[] args) 562 private void HandleClientGetCommand(string module, string[] args)
562 { 563 {
563 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) 564 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
@@ -584,11 +585,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
584 m_console.OutputFormat( 585 m_console.OutputFormat(
585 "Client debug parameters for {0} ({1}) in {2}", 586 "Client debug parameters for {0} ({1}) in {2}",
586 sp.Name, sp.IsChildAgent ? "child" : "root", m_udpServer.Scene.Name); 587 sp.Name, sp.IsChildAgent ? "child" : "root", m_udpServer.Scene.Name);
587
588 ConsoleDisplayList cdl = new ConsoleDisplayList();
589 cdl.AddRow("process-unacked-sends", udpClient.ProcessUnackedSends);
590
591 m_console.Output(cdl.ToString());
592 } 588 }
593 }); 589 });
594 } 590 }
@@ -611,28 +607,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
611 607
612 if (args.Length == 8) 608 if (args.Length == 8)
613 name = string.Format("{0} {1}", args[6], args[7]); 609 name = string.Format("{0} {1}", args[6], args[7]);
614 610 // nothing here now
615 if (param == "process-unacked-sends")
616 {
617 bool newValue;
618
619 if (!ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, rawValue, out newValue))
620 return;
621
622 m_udpServer.Scene.ForEachScenePresence(
623 sp =>
624 {
625 if ((name == null || sp.Name == name) && sp.ControllingClient is LLClientView)
626 {
627 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
628 udpClient.ProcessUnackedSends = newValue;
629
630 m_console.OutputFormat("{0} set to {1} for {2} in {3}", param, newValue, sp.Name, m_udpServer.Scene.Name);
631 }
632 });
633 }
634 } 611 }
635 612*/
636 private void HandlePacketCommand(string module, string[] args) 613 private void HandlePacketCommand(string module, string[] args)
637 { 614 {
638 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) 615 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index 14099fe..fd369c4 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -289,7 +289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
289 public int GetCatBytesCanSend(int timeMS) 289 public int GetCatBytesCanSend(int timeMS)
290 { 290 {
291// return (int)(m_tokenCount + timeMS * m_dripRate * 1e-3); 291// return (int)(m_tokenCount + timeMS * m_dripRate * 1e-3);
292 return (int)(timeMS * m_dripRate * 1e-3); 292 return (int)(timeMS * DripRate * 1e-3);
293 } 293 }
294 294
295 /// <summary> 295 /// <summary>