diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs index 4e71d5ec79..acd14258cc 100644 --- a/OpenSim/Framework/PacketPool.cs +++ b/OpenSim/Framework/PacketPool.cs @@ -48,45 +48,6 @@ namespace OpenSim.Framework get { return instance; } } - public static void EncodeProxyMessage(byte[] bytes, ref int numBytes, EndPoint trueEP) - { - if (numBytes > 4090) // max UPD size = 4096 - { - throw new Exception("ERROR: No space to encode the proxy EP"); - } - - ushort port = (ushort) ((IPEndPoint) trueEP).Port; - bytes[numBytes++] = (byte) (port % 256); - bytes[numBytes++] = (byte) (port / 256); - - foreach (byte b in ((IPEndPoint) trueEP).Address.GetAddressBytes()) - { - bytes[numBytes++] = b; - } - - int x = numBytes; - - DecodeProxyMessage(bytes, ref numBytes); - - numBytes = x; - } - - public static EndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes) - { - // IPv4 Only - byte[] addr = new byte[4]; - - addr[3] = bytes[--numBytes]; - addr[2] = bytes[--numBytes]; - addr[1] = bytes[--numBytes]; - addr[0] = bytes[--numBytes]; - - ushort port = (ushort) (bytes[--numBytes] * 256); - port += (ushort) bytes[--numBytes]; - - return (EndPoint) new IPEndPoint(new IPAddress(addr), (int) port); - } - public Packet GetPacket(PacketType type) { Packet packet; @@ -175,4 +136,4 @@ namespace OpenSim.Framework */ } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 41a3197585..b08b59de26 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -259,7 +259,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP epProxy = epSender; if (proxyPortOffset != 0) { - epSender = PacketPool.DecodeProxyMessage(RecvBuffer, ref numBytes); + epSender = ProxyCodec.DecodeProxyMessage(RecvBuffer, ref numBytes); } int packetEnd = numBytes - 1; @@ -463,7 +463,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (proxyPortOffset != 0) { //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString()); - PacketPool.EncodeProxyMessage(buffer, ref size, sendto); + ProxyCodec.EncodeProxyMessage(buffer, ref size, sendto); m_socket.SendTo(buffer, size, flags, proxyCircuits[circuitcode]); } else diff --git a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs index a3108f69f1..7eefcf5e0a 100644 --- a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs +++ b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs @@ -404,7 +404,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy { try { - client = PacketPool.DecodeProxyMessage(buffer, ref numBytes); + client = ProxyCodec.DecodeProxyMessage(buffer, ref numBytes); try { // This message comes from a region object, forward it to the its client @@ -432,7 +432,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy else { // This message comes from a client object, forward it to the the region(s) - PacketPool.EncodeProxyMessage(buffer, ref numBytes, senderEP); + ProxyCodec.EncodeProxyMessage(buffer, ref numBytes, senderEP); ProxyMap.RegionData rd = proxy_map.GetRegionData(sd.clientEP); foreach (EndPoint region in rd.regions) {