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

avinationmerge
UbitUmarov 2015-09-22 18:39:59 +01:00
parent 032958709b
commit a8dc07ff5c
5 changed files with 37 additions and 102 deletions

View File

@ -1209,8 +1209,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public virtual bool CanSendLayerData() public virtual bool CanSendLayerData()
{ {
int n = m_udpClient.GetCatBytesInSendQueue(ThrottleOutPacketType.Land); int n = m_udpClient.GetPacketsQueuedCount(ThrottleOutPacketType.Land);
if ( n > 100000) if ( n > 256)
return false; return false;
return true; return true;
} }
@ -1355,15 +1355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
try try
{ {
/* test code using the terrain compressor in libOpenMetaverse int PatchesAssumedToFit = 3;
int[] patchInd = new int[1];
patchInd[0] = px + (py * Constants.TerrainPatchSize);
LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(terrData.GetFloatsSerialized(), patchInd);
*/
// Many, many patches could have been passed to us. Since the patches will be compressed
// into variable sized blocks, we cannot pre-compute how many will fit into one
// packet. While some fancy packing algorithm is possible, 4 seems to always fit.
int PatchesAssumedToFit = 4;
for (int pcnt = 0; pcnt < px.Length; pcnt += PatchesAssumedToFit) for (int pcnt = 0; pcnt < px.Length; pcnt += PatchesAssumedToFit)
{ {
int remaining = Math.Min(px.Length - pcnt, PatchesAssumedToFit); int remaining = Math.Min(px.Length - pcnt, PatchesAssumedToFit);
@ -1377,10 +1369,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, xPatches, yPatches); LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, xPatches, yPatches);
// DebugSendingPatches("SendLayerDataInternal", xPatches, yPatches); // DebugSendingPatches("SendLayerDataInternal", xPatches, yPatches);
SendTheLayerPacket(layerpack); OutPacket(layerpack, ThrottleOutPacketType.Land);
} }
// LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, px, py);
} }
catch (Exception e) catch (Exception e)
{ {
@ -1388,11 +1378,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
private void SendTheLayerPacket(LayerDataPacket layerpack)
{
OutPacket(layerpack, ThrottleOutPacketType.Land);
}
/// <summary> /// <summary>
/// Send the wind matrix to the client /// Send the wind matrix to the client
/// </summary> /// </summary>

View File

@ -122,11 +122,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary> /// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary>
public readonly IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200); public readonly IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200);
/// <summary>
/// If true then we take action in response to unacked reliably sent packets such as resending the packet.
/// </summary>
public bool ProcessUnackedSends { get; set; }
/// <summary>Packets we have sent that need to be ACKed by the client</summary> /// <summary>Packets we have sent that need to be ACKed by the client</summary>
public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection();
@ -252,8 +247,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (maxRTO != 0) if (maxRTO != 0)
m_maxRTO = maxRTO; m_maxRTO = maxRTO;
ProcessUnackedSends = true;
m_burstTime = rates.BrustTime; m_burstTime = rates.BrustTime;
float m_burst = rates.ClientMaxRate * m_burstTime; float m_burst = rates.ClientMaxRate * m_burstTime;
@ -357,8 +350,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="throttleType"></param> /// <param name="throttleType"></param>
public int GetPacketsQueuedCount(ThrottleOutPacketType throttleType) public int GetPacketsQueuedCount(ThrottleOutPacketType throttleType)
{ {
if ((int)throttleType > 0) int icat = (int)throttleType;
return m_packetOutboxes[(int)throttleType].Count; if (icat > 0 && icat < THROTTLE_CATEGORY_COUNT)
return m_packetOutboxes[icat].Count;
else else
return 0; return 0;
} }
@ -545,20 +539,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return data; return data;
} }
public int GetCatBytesInSendQueue(ThrottleOutPacketType cat)
{
;
int icat = (int)cat;
if (icat > 0 && icat < THROTTLE_CATEGORY_COUNT)
{
TokenBucket bucket = m_throttleCategories[icat];
return m_packetOutboxes[icat].Count;
}
else
return 0;
}
public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS) public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS)
{ {
int icat = (int)cat; int icat = (int)cat;

View File

@ -991,8 +991,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bufferSize = dataLength; bufferSize = dataLength;
buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize); buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize);
// m_log.Error("[LLUDPSERVER]: Packet exceeded buffer size! This could be an indication of packet assembly not obeying the MTU. Type=" + m_log.Error("[LLUDPSERVER]: Packet exceeded buffer size! This could be an indication of packet assembly not obeying the MTU. Type=" +
// type + ", DataLength=" + dataLength + ", BufferLength=" + buffer.Data.Length + ". Dropping packet"); type + ", DataLength=" + dataLength + ", BufferLength=" + buffer.Data.Length);
Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength); Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength);
} }
} }
@ -1200,7 +1200,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Utils.UIntToBytesBig(sequenceNumber, buffer.Data, 1); Utils.UIntToBytesBig(sequenceNumber, buffer.Data, 1);
outgoingPacket.SequenceNumber = sequenceNumber; outgoingPacket.SequenceNumber = sequenceNumber;
if (udpClient.ProcessUnackedSends && isReliable) if (isReliable)
{ {
// Add this packet to the list of ACK responses we are waiting on from the server // Add this packet to the list of ACK responses we are waiting on from the server
udpClient.NeedAcks.Add(outgoingPacket); udpClient.NeedAcks.Add(outgoingPacket);
@ -1418,8 +1418,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region ACK Receiving #region ACK Receiving
if (udpClient.ProcessUnackedSends)
{
// Handle appended ACKs // Handle appended ACKs
if (packet.Header.AppendedAcks && packet.Header.AckList != null) if (packet.Header.AppendedAcks && packet.Header.AckList != null)
{ {
@ -1446,11 +1444,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// We don't need to do anything else with PacketAck packets // We don't need to do anything else with PacketAck packets
return; return;
} }
}
else if (packet.Type == PacketType.PacketAck)
{
return;
}
#endregion ACK Receiving #endregion ACK Receiving
@ -1510,7 +1503,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion BinaryStats #endregion BinaryStats
//Ubit AgentUpdate mess removed from here //AgentUpdate removed from here
#region Ping Check Handling #region Ping Check Handling
@ -2168,7 +2161,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (udpClient.IsConnected) if (udpClient.IsConnected)
{ {
if (udpClient.ProcessUnackedSends && m_resendUnacked) if (m_resendUnacked)
HandleUnacked(llClient); HandleUnacked(llClient);
if (m_sendAcks) if (m_sendAcks)

View File

@ -558,6 +558,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_console.OutputFormat("{0} set to {1} in {2}", param, rawValue, m_udpServer.Scene.Name); m_console.OutputFormat("{0} set to {1} in {2}", param, rawValue, m_udpServer.Scene.Name);
} }
/* not in use, nothing to set/get from lludp
private void HandleClientGetCommand(string module, string[] args) private void HandleClientGetCommand(string module, string[] args)
{ {
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
@ -584,11 +585,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_console.OutputFormat( m_console.OutputFormat(
"Client debug parameters for {0} ({1}) in {2}", "Client debug parameters for {0} ({1}) in {2}",
sp.Name, sp.IsChildAgent ? "child" : "root", m_udpServer.Scene.Name); sp.Name, sp.IsChildAgent ? "child" : "root", m_udpServer.Scene.Name);
ConsoleDisplayList cdl = new ConsoleDisplayList();
cdl.AddRow("process-unacked-sends", udpClient.ProcessUnackedSends);
m_console.Output(cdl.ToString());
} }
}); });
} }
@ -611,28 +607,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (args.Length == 8) if (args.Length == 8)
name = string.Format("{0} {1}", args[6], args[7]); name = string.Format("{0} {1}", args[6], args[7]);
// nothing here now
if (param == "process-unacked-sends")
{
bool newValue;
if (!ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, rawValue, out newValue))
return;
m_udpServer.Scene.ForEachScenePresence(
sp =>
{
if ((name == null || sp.Name == name) && sp.ControllingClient is LLClientView)
{
LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
udpClient.ProcessUnackedSends = newValue;
m_console.OutputFormat("{0} set to {1} for {2} in {3}", param, newValue, sp.Name, m_udpServer.Scene.Name);
} }
}); */
}
}
private void HandlePacketCommand(string module, string[] args) private void HandlePacketCommand(string module, string[] args)
{ {
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)

View File

@ -289,7 +289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public int GetCatBytesCanSend(int timeMS) public int GetCatBytesCanSend(int timeMS)
{ {
// return (int)(m_tokenCount + timeMS * m_dripRate * 1e-3); // return (int)(m_tokenCount + timeMS * m_dripRate * 1e-3);
return (int)(timeMS * m_dripRate * 1e-3); return (int)(timeMS * DripRate * 1e-3);
} }
/// <summary> /// <summary>