diff options
author | UbitUmarov | 2019-03-18 23:36:49 +0000 |
---|---|---|
committer | UbitUmarov | 2019-03-18 23:36:49 +0000 |
commit | 199d4a1bd02c5e782db65a320b6965388ded1fb6 (patch) | |
tree | 2ee4d7e0826dda8b99804ba6273530323d3ebe9b /OpenSim | |
parent | also fix the ThrottleOutPacketType (diff) | |
download | opensim-SC-199d4a1bd02c5e782db65a320b6965388ded1fb6.zip opensim-SC-199d4a1bd02c5e782db65a320b6965388ded1fb6.tar.gz opensim-SC-199d4a1bd02c5e782db65a320b6965388ded1fb6.tar.bz2 opensim-SC-199d4a1bd02c5e782db65a320b6965388ded1fb6.tar.xz |
lludp ReplyTaskInventory, SendXferPacket and AbortXfer enconding
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 91 |
1 files changed, 73 insertions, 18 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e3d04b5..0d78654 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -2724,34 +2724,89 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2724 | OutPacket(scriptcontrol, ThrottleOutPacketType.Task); | 2724 | OutPacket(scriptcontrol, ThrottleOutPacketType.Task); |
2725 | } | 2725 | } |
2726 | 2726 | ||
2727 | static private readonly byte[] ReplyTaskInventoryHeader = new byte[] { | ||
2728 | Helpers.MSG_RELIABLE, //| Helpers.MSG_ZEROCODED, not doing spec zeroencode on this | ||
2729 | 0, 0, 0, 0, // sequence number | ||
2730 | 0, // extra | ||
2731 | 0xff, 0xff, 1, 34 // ID 90 (low frequency bigendian) | ||
2732 | }; | ||
2733 | |||
2727 | public void SendTaskInventory(UUID taskID, short serial, byte[] fileName) | 2734 | public void SendTaskInventory(UUID taskID, short serial, byte[] fileName) |
2728 | { | 2735 | { |
2729 | ReplyTaskInventoryPacket replytask = (ReplyTaskInventoryPacket)PacketPool.Instance.GetPacket(PacketType.ReplyTaskInventory); | 2736 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
2730 | replytask.InventoryData.TaskID = taskID; | 2737 | byte[] data = buf.Data; |
2731 | replytask.InventoryData.Serial = serial; | 2738 | |
2732 | replytask.InventoryData.Filename = fileName; | 2739 | //setup header |
2733 | // OutPacket(replytask, ThrottleOutPacketType.Task); | 2740 | Buffer.BlockCopy(ReplyTaskInventoryHeader, 0, data, 0, 10); |
2734 | OutPacket(replytask, ThrottleOutPacketType.Asset); | 2741 | |
2742 | taskID.ToBytes(data, 10); // 26 | ||
2743 | Utils.Int16ToBytes(serial, data, 26); // 28 | ||
2744 | data[28] = (byte)fileName.Length; | ||
2745 | if(data[28] > 0) | ||
2746 | Buffer.BlockCopy(fileName, 0, data, 29, data[28]); | ||
2747 | |||
2748 | buf.DataLength = 29 + data[28]; | ||
2749 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); | ||
2750 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); | ||
2735 | } | 2751 | } |
2736 | 2752 | ||
2737 | public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) | 2753 | |
2754 | static private readonly byte[] SendXferPacketHeader = new byte[] { | ||
2755 | Helpers.MSG_RELIABLE, | ||
2756 | 0, 0, 0, 0, // sequence number | ||
2757 | 0, // extra | ||
2758 | 18 // ID (high frequency bigendian) | ||
2759 | }; | ||
2760 | |||
2761 | public void SendXferPacket(ulong xferID, uint packet, byte[] payload, bool isTaskInventory) | ||
2738 | { | 2762 | { |
2739 | ThrottleOutPacketType type = ThrottleOutPacketType.Asset; | 2763 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
2740 | // if (isTaskInventory) | 2764 | byte[] data = buf.Data; |
2741 | // type = ThrottleOutPacketType.Task; | ||
2742 | 2765 | ||
2743 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); | 2766 | //setup header |
2744 | sendXfer.XferID.ID = xferID; | 2767 | Buffer.BlockCopy(SendXferPacketHeader, 0, data, 0, 7); |
2745 | sendXfer.XferID.Packet = packet; | 2768 | |
2746 | sendXfer.DataPacket.Data = data; | 2769 | Utils.UInt64ToBytesSafepos(xferID, data, 7); // 15 |
2747 | OutPacket(sendXfer, type); | 2770 | Utils.UIntToBytesSafepos(packet, data, 15); // 19 |
2771 | int len = payload.Length; | ||
2772 | if (len > LLUDPServer.MAXPAYLOAD) // should never happen | ||
2773 | len = LLUDPServer.MAXPAYLOAD; | ||
2774 | if (len == 0) | ||
2775 | { | ||
2776 | data[19] = 0; | ||
2777 | data[20] = 0; | ||
2778 | } | ||
2779 | else | ||
2780 | { | ||
2781 | data[19] = (byte)len; | ||
2782 | data[20] = (byte)(len >> 8); | ||
2783 | Buffer.BlockCopy(payload, 0, data, 21, len); | ||
2784 | } | ||
2785 | |||
2786 | buf.DataLength = 21 + len; | ||
2787 | m_udpServer.SendUDPPacket(m_udpClient, buf, isTaskInventory ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); | ||
2748 | } | 2788 | } |
2749 | 2789 | ||
2790 | static private readonly byte[] AbortXferHeader = new byte[] { | ||
2791 | Helpers.MSG_RELIABLE, | ||
2792 | 0, 0, 0, 0, // sequence number | ||
2793 | 0, // extra | ||
2794 | 0xff, 0xff, 0, 157 // ID 157 (low frequency bigendian) | ||
2795 | }; | ||
2796 | |||
2750 | public void SendAbortXferPacket(ulong xferID) | 2797 | public void SendAbortXferPacket(ulong xferID) |
2751 | { | 2798 | { |
2752 | AbortXferPacket xferItem = (AbortXferPacket)PacketPool.Instance.GetPacket(PacketType.AbortXfer); | 2799 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
2753 | xferItem.XferID.ID = xferID; | 2800 | byte[] data = buf.Data; |
2754 | OutPacket(xferItem, ThrottleOutPacketType.Asset); | 2801 | |
2802 | //setup header | ||
2803 | Buffer.BlockCopy(AbortXferHeader, 0, data, 0, 10); | ||
2804 | |||
2805 | Utils.UInt64ToBytesSafepos(xferID, data, 10); // 18 | ||
2806 | Utils.IntToBytesSafepos(0, data, 18); // 22 reason TODO | ||
2807 | |||
2808 | buf.DataLength = 22; | ||
2809 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Asset); | ||
2755 | } | 2810 | } |
2756 | 2811 | ||
2757 | public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, | 2812 | public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, |