diff options
-rw-r--r-- | OpenSim/Framework/PacketPool.cs | 41 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 4 | ||||
-rw-r--r-- | ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs | 4 |
3 files changed, 5 insertions, 44 deletions
diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs index 4e71d5e..acd1425 100644 --- a/OpenSim/Framework/PacketPool.cs +++ b/OpenSim/Framework/PacketPool.cs | |||
@@ -48,45 +48,6 @@ namespace OpenSim.Framework | |||
48 | get { return instance; } | 48 | get { return instance; } |
49 | } | 49 | } |
50 | 50 | ||
51 | public static void EncodeProxyMessage(byte[] bytes, ref int numBytes, EndPoint trueEP) | ||
52 | { | ||
53 | if (numBytes > 4090) // max UPD size = 4096 | ||
54 | { | ||
55 | throw new Exception("ERROR: No space to encode the proxy EP"); | ||
56 | } | ||
57 | |||
58 | ushort port = (ushort) ((IPEndPoint) trueEP).Port; | ||
59 | bytes[numBytes++] = (byte) (port % 256); | ||
60 | bytes[numBytes++] = (byte) (port / 256); | ||
61 | |||
62 | foreach (byte b in ((IPEndPoint) trueEP).Address.GetAddressBytes()) | ||
63 | { | ||
64 | bytes[numBytes++] = b; | ||
65 | } | ||
66 | |||
67 | int x = numBytes; | ||
68 | |||
69 | DecodeProxyMessage(bytes, ref numBytes); | ||
70 | |||
71 | numBytes = x; | ||
72 | } | ||
73 | |||
74 | public static EndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes) | ||
75 | { | ||
76 | // IPv4 Only | ||
77 | byte[] addr = new byte[4]; | ||
78 | |||
79 | addr[3] = bytes[--numBytes]; | ||
80 | addr[2] = bytes[--numBytes]; | ||
81 | addr[1] = bytes[--numBytes]; | ||
82 | addr[0] = bytes[--numBytes]; | ||
83 | |||
84 | ushort port = (ushort) (bytes[--numBytes] * 256); | ||
85 | port += (ushort) bytes[--numBytes]; | ||
86 | |||
87 | return (EndPoint) new IPEndPoint(new IPAddress(addr), (int) port); | ||
88 | } | ||
89 | |||
90 | public Packet GetPacket(PacketType type) | 51 | public Packet GetPacket(PacketType type) |
91 | { | 52 | { |
92 | Packet packet; | 53 | Packet packet; |
@@ -175,4 +136,4 @@ namespace OpenSim.Framework | |||
175 | */ | 136 | */ |
176 | } | 137 | } |
177 | } | 138 | } |
178 | } \ No newline at end of file | 139 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 41a3197..b08b59d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -259,7 +259,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
259 | epProxy = epSender; | 259 | epProxy = epSender; |
260 | if (proxyPortOffset != 0) | 260 | if (proxyPortOffset != 0) |
261 | { | 261 | { |
262 | epSender = PacketPool.DecodeProxyMessage(RecvBuffer, ref numBytes); | 262 | epSender = ProxyCodec.DecodeProxyMessage(RecvBuffer, ref numBytes); |
263 | } | 263 | } |
264 | 264 | ||
265 | int packetEnd = numBytes - 1; | 265 | int packetEnd = numBytes - 1; |
@@ -463,7 +463,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
463 | if (proxyPortOffset != 0) | 463 | if (proxyPortOffset != 0) |
464 | { | 464 | { |
465 | //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString()); | 465 | //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString()); |
466 | PacketPool.EncodeProxyMessage(buffer, ref size, sendto); | 466 | ProxyCodec.EncodeProxyMessage(buffer, ref size, sendto); |
467 | m_socket.SendTo(buffer, size, flags, proxyCircuits[circuitcode]); | 467 | m_socket.SendTo(buffer, size, flags, proxyCircuits[circuitcode]); |
468 | } | 468 | } |
469 | else | 469 | else |
diff --git a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs index a3108f6..7eefcf5 100644 --- a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs +++ b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs | |||
@@ -404,7 +404,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy | |||
404 | { | 404 | { |
405 | try | 405 | try |
406 | { | 406 | { |
407 | client = PacketPool.DecodeProxyMessage(buffer, ref numBytes); | 407 | client = ProxyCodec.DecodeProxyMessage(buffer, ref numBytes); |
408 | try | 408 | try |
409 | { | 409 | { |
410 | // This message comes from a region object, forward it to the its client | 410 | // This message comes from a region object, forward it to the its client |
@@ -432,7 +432,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy | |||
432 | else | 432 | else |
433 | { | 433 | { |
434 | // This message comes from a client object, forward it to the the region(s) | 434 | // This message comes from a client object, forward it to the the region(s) |
435 | PacketPool.EncodeProxyMessage(buffer, ref numBytes, senderEP); | 435 | ProxyCodec.EncodeProxyMessage(buffer, ref numBytes, senderEP); |
436 | ProxyMap.RegionData rd = proxy_map.GetRegionData(sd.clientEP); | 436 | ProxyMap.RegionData rd = proxy_map.GetRegionData(sd.clientEP); |
437 | foreach (EndPoint region in rd.regions) | 437 | foreach (EndPoint region in rd.regions) |
438 | { | 438 | { |