diff options
author | UbitUmarov | 2019-03-18 18:58:07 +0000 |
---|---|---|
committer | UbitUmarov | 2019-03-18 18:58:07 +0000 |
commit | 6fd7b931b1a7dade8604fb0356fc6e0058fd5135 (patch) | |
tree | d13e3e09295b3cadc4febe189026cb378ff29f80 /OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |
parent | lludp AgentMovementComplete enconding (diff) | |
download | opensim-SC-6fd7b931b1a7dade8604fb0356fc6e0058fd5135.zip opensim-SC-6fd7b931b1a7dade8604fb0356fc6e0058fd5135.tar.gz opensim-SC-6fd7b931b1a7dade8604fb0356fc6e0058fd5135.tar.bz2 opensim-SC-6fd7b931b1a7dade8604fb0356fc6e0058fd5135.tar.xz |
lludp ChatFromSimulator enconding; some simplification
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 89 |
1 files changed, 62 insertions, 27 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ab5790c..97b2c5c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -913,24 +913,60 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
913 | } | 913 | } |
914 | 914 | ||
915 | buf.DataLength = 80 + len; | 915 | buf.DataLength = 80 + len; |
916 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, false); | 916 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); |
917 | } | 917 | } |
918 | 918 | ||
919 | public void SendChatMessage( | 919 | static private readonly byte[] ChatFromSimulatorHeader = new byte[] { |
920 | string message, byte type, Vector3 fromPos, string fromName, | 920 | Helpers.MSG_RELIABLE, |
921 | UUID fromAgentID, UUID ownerID, byte source, byte audible) | 921 | 0, 0, 0, 0, // sequence number |
922 | 0, // extra | ||
923 | 0xff, 0xff, 0, 139 // ID 139 (low frequency bigendian) | ||
924 | }; | ||
925 | |||
926 | public void SendChatMessage(string message, byte chattype, Vector3 fromPos, string fromName, | ||
927 | UUID sourceID, UUID ownerID, byte sourcetype, byte audible) | ||
922 | { | 928 | { |
923 | ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); | 929 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
924 | reply.ChatData.Audible = audible; | 930 | byte[] data = buf.Data; |
925 | reply.ChatData.Message = Util.StringToBytes1024(message); | 931 | |
926 | reply.ChatData.ChatType = type; | 932 | //setup header |
927 | reply.ChatData.SourceType = source; | 933 | Buffer.BlockCopy(ChatFromSimulatorHeader, 0, data, 0, 10); |
928 | reply.ChatData.Position = fromPos; | 934 | |
929 | reply.ChatData.FromName = Util.StringToBytes256(fromName); | 935 | byte[] fname = Util.StringToBytes256(fromName); |
930 | reply.ChatData.OwnerID = ownerID; | 936 | int len = fname.Length; |
931 | reply.ChatData.SourceID = fromAgentID; | 937 | int pos = 11; |
938 | if (len == 0) | ||
939 | data[10] = 0; | ||
940 | else | ||
941 | { | ||
942 | data[10] = (byte)len; | ||
943 | Buffer.BlockCopy(fname, 0, data, 11, len); | ||
944 | pos += len; | ||
945 | } | ||
946 | |||
947 | sourceID.ToBytes(data, pos); pos += 16; | ||
948 | ownerID.ToBytes(data, pos); pos += 16; | ||
949 | data[pos++] = sourcetype; | ||
950 | data[pos++] = chattype; | ||
951 | data[pos++] = audible; | ||
952 | fromPos.ToBytes(data, pos); pos += 12; | ||
953 | |||
954 | byte[] msg = Util.StringToBytes1024(message); | ||
955 | len = msg.Length; | ||
956 | if (len == 0) | ||
957 | { | ||
958 | data[pos++] = 0; | ||
959 | data[pos++] = 0; | ||
960 | } | ||
961 | else | ||
962 | { | ||
963 | data[pos++] = (byte)len; | ||
964 | data[pos++] = (byte)(len >> 8); | ||
965 | Buffer.BlockCopy(msg, 0, data, pos, len); pos += len; | ||
966 | } | ||
932 | 967 | ||
933 | OutPacket(reply, ThrottleOutPacketType.Unknown); | 968 | buf.DataLength = pos; |
969 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); | ||
934 | } | 970 | } |
935 | 971 | ||
936 | /// <summary> | 972 | /// <summary> |
@@ -1336,7 +1372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1336 | data[9] = (byte)(datasize >> 8); | 1372 | data[9] = (byte)(datasize >> 8); |
1337 | 1373 | ||
1338 | buf.DataLength = bitpack.BytePos + 1; | 1374 | buf.DataLength = bitpack.BytePos + 1; |
1339 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); | 1375 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); |
1340 | 1376 | ||
1341 | // start another | 1377 | // start another |
1342 | buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | 1378 | buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
@@ -1364,7 +1400,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1364 | data[9] = (byte)(datasize >> 8); | 1400 | data[9] = (byte)(datasize >> 8); |
1365 | 1401 | ||
1366 | buf.DataLength = bitpack.BytePos + 1; | 1402 | buf.DataLength = bitpack.BytePos + 1; |
1367 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); | 1403 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); |
1368 | 1404 | ||
1369 | } | 1405 | } |
1370 | catch (Exception e) | 1406 | catch (Exception e) |
@@ -1645,7 +1681,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1645 | 1681 | ||
1646 | buf.DataLength = lastpos; | 1682 | buf.DataLength = lastpos; |
1647 | // send it | 1683 | // send it |
1648 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); | 1684 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); |
1649 | 1685 | ||
1650 | buf = newbuf; | 1686 | buf = newbuf; |
1651 | data = buf.Data; | 1687 | data = buf.Data; |
@@ -1661,7 +1697,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1661 | data[countpos] = (byte)count; | 1697 | data[countpos] = (byte)count; |
1662 | 1698 | ||
1663 | buf.DataLength = pos; | 1699 | buf.DataLength = pos; |
1664 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); | 1700 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); |
1665 | } | 1701 | } |
1666 | } | 1702 | } |
1667 | 1703 | ||
@@ -1757,7 +1793,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1757 | 1793 | ||
1758 | buf.DataLength = lastpos; | 1794 | buf.DataLength = lastpos; |
1759 | // send it | 1795 | // send it |
1760 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); | 1796 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); |
1761 | 1797 | ||
1762 | buf = newbuf; | 1798 | buf = newbuf; |
1763 | data = buf.Data; | 1799 | data = buf.Data; |
@@ -1786,7 +1822,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1786 | data[pos++] = 0; | 1822 | data[pos++] = 0; |
1787 | 1823 | ||
1788 | buf.DataLength = pos; | 1824 | buf.DataLength = pos; |
1789 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land, null, false, false); | 1825 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Land); |
1790 | } | 1826 | } |
1791 | } | 1827 | } |
1792 | 1828 | ||
@@ -4122,8 +4158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4122 | data[pos++] = 0; // no physical avatar events | 4158 | data[pos++] = 0; // no physical avatar events |
4123 | 4159 | ||
4124 | buf.DataLength = pos; | 4160 | buf.DataLength = pos; |
4125 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority, | 4161 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
4126 | null, false, false); | ||
4127 | } | 4162 | } |
4128 | 4163 | ||
4129 | public void SendObjectAnimations(UUID[] animations, int[] seqs, UUID senderId) | 4164 | public void SendObjectAnimations(UUID[] animations, int[] seqs, UUID senderId) |
@@ -4180,7 +4215,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4180 | CreatePrimUpdateBlock(ent as SceneObjectPart, (ScenePresence)SceneAgent, zc); | 4215 | CreatePrimUpdateBlock(ent as SceneObjectPart, (ScenePresence)SceneAgent, zc); |
4181 | 4216 | ||
4182 | buf.DataLength = zc.Finish(); | 4217 | buf.DataLength = zc.Finish(); |
4183 | m_udpServer.SendUDPPacket(m_udpClient, buf, ptype , null, false, false); | 4218 | m_udpServer.SendUDPPacket(m_udpClient, buf, ptype); |
4184 | } | 4219 | } |
4185 | 4220 | ||
4186 | public void SendEntityTerseUpdateImmediate(ISceneEntity ent) | 4221 | public void SendEntityTerseUpdateImmediate(ISceneEntity ent) |
@@ -4275,7 +4310,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4275 | } | 4310 | } |
4276 | 4311 | ||
4277 | buf.DataLength = pos; | 4312 | buf.DataLength = pos; |
4278 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); | 4313 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); |
4279 | } | 4314 | } |
4280 | 4315 | ||
4281 | #endregion Avatar Packet/Data Sending Methods | 4316 | #endregion Avatar Packet/Data Sending Methods |
@@ -5332,7 +5367,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5332 | 5367 | ||
5333 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, | 5368 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, |
5334 | // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); | 5369 | // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); |
5335 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); | 5370 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); |
5336 | buf = newbuf; | 5371 | buf = newbuf; |
5337 | zc.Data = buf.Data; | 5372 | zc.Data = buf.Data; |
5338 | zc.ZeroCount = 0; | 5373 | zc.ZeroCount = 0; |
@@ -5353,7 +5388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5353 | buf.DataLength = zc.Finish(); | 5388 | buf.DataLength = zc.Finish(); |
5354 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, | 5389 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, |
5355 | // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); | 5390 | // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); |
5356 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); | 5391 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); |
5357 | } | 5392 | } |
5358 | } | 5393 | } |
5359 | 5394 | ||
@@ -5373,7 +5408,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5373 | //tau.Add(new ObjectPropertyUpdate((ISceneEntity) eu, (uint)eu.Flags, true, false)); | 5408 | //tau.Add(new ObjectPropertyUpdate((ISceneEntity) eu, (uint)eu.Flags, true, false)); |
5374 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, | 5409 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, |
5375 | // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); | 5410 | // delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false, false); |
5376 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, false); | 5411 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); |
5377 | } | 5412 | } |
5378 | } | 5413 | } |
5379 | 5414 | ||