diff options
author | UbitUmarov | 2019-03-19 08:52:14 +0000 |
---|---|---|
committer | UbitUmarov | 2019-03-19 08:52:14 +0000 |
commit | 71361f61f41d0a37efcf4f9637b1270a13d7a47c (patch) | |
tree | 8f33788f0d88a41fa8b2a842e661af7bf3b343a8 /OpenSim/Region/ClientStack/Linden/UDP | |
parent | UnAckedBytes are in KB (diff) | |
download | opensim-SC-71361f61f41d0a37efcf4f9637b1270a13d7a47c.zip opensim-SC-71361f61f41d0a37efcf4f9637b1270a13d7a47c.tar.gz opensim-SC-71361f61f41d0a37efcf4f9637b1270a13d7a47c.tar.bz2 opensim-SC-71361f61f41d0a37efcf4f9637b1270a13d7a47c.tar.xz |
lludp SimStats encoding
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0cba495..41f40da 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -5412,21 +5412,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5412 | OutPacket(PacketPool.Instance.GetPacket(PacketType.DisableSimulator), ThrottleOutPacketType.Unknown); | 5412 | OutPacket(PacketPool.Instance.GetPacket(PacketType.DisableSimulator), ThrottleOutPacketType.Unknown); |
5413 | } | 5413 | } |
5414 | 5414 | ||
5415 | static private readonly byte[] SimStatsHeader = new byte[] { | ||
5416 | 0, | ||
5417 | 0, 0, 0, 0, // sequence number | ||
5418 | 0, // extra | ||
5419 | 0xff, 0xff, 0, 140 // ID 140 (low frequency bigendian) | ||
5420 | }; | ||
5421 | |||
5415 | public void SendSimStats(SimStats stats) | 5422 | public void SendSimStats(SimStats stats) |
5416 | { | 5423 | { |
5417 | stats.StatsBlock[15].StatValue /= 1024; // UnAckedBytes are in KB | 5424 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
5418 | SimStatsPacket pack = new SimStatsPacket(); | 5425 | byte[] data = buf.Data; |
5419 | pack.Region = new SimStatsPacket.RegionBlock(); | 5426 | |
5420 | pack.Region.RegionX = stats.RegionX; | 5427 | //setup header |
5421 | pack.Region.RegionY = stats.RegionY; | 5428 | Buffer.BlockCopy(SimStatsHeader, 0, data, 0, 10); |
5422 | pack.Region.RegionFlags = stats.RegionFlags; | 5429 | |
5423 | pack.Region.ObjectCapacity = stats.ObjectCapacity; | 5430 | // Region Block |
5424 | //pack.Region = //stats.RegionBlock; | 5431 | Utils.UIntToBytesSafepos(stats.RegionX, data, 10); |
5425 | pack.Stat = stats.StatsBlock; | 5432 | Utils.UIntToBytesSafepos(stats.RegionY, data, 14); |
5426 | 5433 | Utils.UIntToBytesSafepos(stats.RegionFlags, data, 18); | |
5427 | pack.Header.Reliable = false; | 5434 | Utils.UIntToBytesSafepos(stats.ObjectCapacity, data, 22); // 26 |
5428 | pack.RegionInfo = new SimStatsPacket.RegionInfoBlock[0]; | 5435 | |
5429 | OutPacket(pack, ThrottleOutPacketType.Task); | 5436 | // stats |
5437 | data[26] = (byte)stats.StatsBlock.Length; | ||
5438 | int pos = 27; | ||
5439 | |||
5440 | for(int i = 0; i< stats.StatsBlock.Length; ++i) | ||
5441 | { | ||
5442 | Utils.UIntToBytesSafepos(stats.StatsBlock[i].StatID, data, pos); pos += 4; | ||
5443 | Utils.FloatToBytesSafepos(stats.StatsBlock[i].StatValue, data, pos); pos += 4; | ||
5444 | } | ||
5445 | |||
5446 | //no PID | ||
5447 | Utils.IntToBytesSafepos(0, data, pos); pos += 4; | ||
5448 | |||
5449 | // no regioninfo (extended flags) | ||
5450 | data[pos++] = 0; // = 1; | ||
5451 | //Utils.UInt64ToBytesSafepos(RegionFlagsExtended, data, pos); pos += 8; | ||
5452 | |||
5453 | buf.DataLength = pos; | ||
5454 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); | ||
5430 | } | 5455 | } |
5431 | 5456 | ||
5432 | private class ObjectPropertyUpdate : EntityUpdate | 5457 | private class ObjectPropertyUpdate : EntityUpdate |