stop sending some useless small packets

0.9.1.0-post-fixes
UbitUmarov 2019-03-17 21:37:21 +00:00
parent 9ccca71c1b
commit b9987b4183
1 changed files with 22 additions and 4 deletions

View File

@ -4184,6 +4184,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true);
} }
//UUID m_courseLocationPrey = UUID.Zero;
bool m_couseLocationLastEmpty = false;
static private readonly byte[] CoarseLocationUpdateHeader = new byte[] { static private readonly byte[] CoarseLocationUpdateHeader = new byte[] {
0, // no acks plz 0, // no acks plz
0, 0, 0, 0, // sequence number 0, 0, 0, 0, // sequence number
@ -4198,6 +4201,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return; return;
int totalLocations = Math.Min(CoarseLocations.Count, 60); int totalLocations = Math.Min(CoarseLocations.Count, 60);
if(totalLocations == 0)
{
if(m_couseLocationLastEmpty)
return;
m_couseLocationLastEmpty = true;
}
else
m_couseLocationLastEmpty = false;
int totalAgents = Math.Min(users.Count, 60); int totalAgents = Math.Min(users.Count, 60);
if(totalAgents > totalLocations) if(totalAgents > totalLocations)
totalAgents = totalLocations; totalAgents = totalLocations;
@ -4205,6 +4217,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int selfindex = -1; int selfindex = -1;
int preyindex = -1; int preyindex = -1;
//bool doprey = m_courseLocationPrey != UUID.Zero;
UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint);
Buffer.BlockCopy(CoarseLocationUpdateHeader, 0, buf.Data, 0, 8); Buffer.BlockCopy(CoarseLocationUpdateHeader, 0, buf.Data, 0, 8);
byte[] data = buf.Data; byte[] data = buf.Data;
@ -4222,8 +4236,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
if (users[i] == AgentId) if (users[i] == AgentId)
selfindex = i; selfindex = i;
//if (users[i] == PreyId) //if (doprey && users[i] == m_courseLocationPrey)
// preyindex = -1; // preyindex = i;
} }
} }
@ -7534,15 +7548,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TrackAgentPacket TrackAgent = TrackAgentPacket TrackAgent =
(TrackAgentPacket)Packet; (TrackAgentPacket)Packet;
if(TrackAgent.AgentData.AgentID != AgentId || TrackAgent.AgentData.SessionID != SessionId)
return false;
TrackAgentUpdate TrackAgentHandler = OnTrackAgent; TrackAgentUpdate TrackAgentHandler = OnTrackAgent;
if (TrackAgentHandler != null) if (TrackAgentHandler != null)
{ {
TrackAgentHandler(this, TrackAgentHandler(this,
TrackAgent.AgentData.AgentID, TrackAgent.AgentData.AgentID,
TrackAgent.TargetData.PreyID); TrackAgent.TargetData.PreyID);
return true;
} }
return false; // else
// m_courseLocationPrey = TrackAgent.TargetData.PreyID;
return true;
} }
private bool HandlerRezObject(IClientAPI sender, Packet Pack) private bool HandlerRezObject(IClientAPI sender, Packet Pack)