aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorUbitUmarov2019-06-09 20:15:36 +0100
committerUbitUmarov2019-06-09 20:15:36 +0100
commit9ff7601214c8cbc022308dc62ed8aa321598a1df (patch)
tree448b410a8b8e90ddf02d5625a7a148b4275b6a50 /OpenSim/Region/ClientStack
parentmantis 8460: reduce odds of watchdog timeout warning (diff)
downloadopensim-SC-9ff7601214c8cbc022308dc62ed8aa321598a1df.zip
opensim-SC-9ff7601214c8cbc022308dc62ed8aa321598a1df.tar.gz
opensim-SC-9ff7601214c8cbc022308dc62ed8aa321598a1df.tar.bz2
opensim-SC-9ff7601214c8cbc022308dc62ed8aa321598a1df.tar.xz
reduce some useless array copies
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs19
1 files changed, 16 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 01a9fb6..5d4d5cd 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -2886,7 +2886,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2886 18 // ID (high frequency bigendian) 2886 18 // ID (high frequency bigendian)
2887 }; 2887 };
2888 2888
2889 public void SendXferPacket(ulong xferID, uint packet, byte[] payload, bool isTaskInventory) 2889 public void SendXferPacket(ulong xferID, uint packet,
2890 byte[] XferData, int XferDataOffset, int XferDatapktLen, bool isTaskInventory)
2890 { 2891 {
2891 UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); 2892 UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint);
2892 byte[] data = buf.Data; 2893 byte[] data = buf.Data;
@@ -2896,7 +2897,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2896 2897
2897 Utils.UInt64ToBytesSafepos(xferID, data, 7); // 15 2898 Utils.UInt64ToBytesSafepos(xferID, data, 7); // 15
2898 Utils.UIntToBytesSafepos(packet, data, 15); // 19 2899 Utils.UIntToBytesSafepos(packet, data, 15); // 19
2899 int len = payload.Length; 2900
2901 int len = XferDatapktLen;
2902 if (XferDataOffset == 0) // first packet needs to send the total xfer data len
2903 len += 4;
2904
2900 if (len > LLUDPServer.MAXPAYLOAD) // should never happen 2905 if (len > LLUDPServer.MAXPAYLOAD) // should never happen
2901 len = LLUDPServer.MAXPAYLOAD; 2906 len = LLUDPServer.MAXPAYLOAD;
2902 if (len == 0) 2907 if (len == 0)
@@ -2908,7 +2913,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2908 { 2913 {
2909 data[19] = (byte)len; 2914 data[19] = (byte)len;
2910 data[20] = (byte)(len >> 8); 2915 data[20] = (byte)(len >> 8);
2911 Buffer.BlockCopy(payload, 0, data, 21, len); 2916 if(XferDataOffset == 0)
2917 {
2918 // need to send total xfer data len
2919 Utils.IntToBytesSafepos(XferData.Length, data, 21);
2920 if (XferDatapktLen > 0)
2921 Buffer.BlockCopy(XferData, XferDataOffset, data, 25, XferDatapktLen);
2922 }
2923 else
2924 Buffer.BlockCopy(XferData, XferDataOffset, data, 21, XferDatapktLen);
2912 } 2925 }
2913 2926
2914 buf.DataLength = 21 + len; 2927 buf.DataLength = 21 + len;