diff options
-rw-r--r-- | OpenSim/Framework/ProxyCodec.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 30 |
2 files changed, 20 insertions, 16 deletions
diff --git a/OpenSim/Framework/ProxyCodec.cs b/OpenSim/Framework/ProxyCodec.cs index df4be64..43c44f8 100644 --- a/OpenSim/Framework/ProxyCodec.cs +++ b/OpenSim/Framework/ProxyCodec.cs | |||
@@ -47,12 +47,6 @@ namespace OpenSim.Framework | |||
47 | { | 47 | { |
48 | bytes[numBytes++] = b; | 48 | bytes[numBytes++] = b; |
49 | } | 49 | } |
50 | |||
51 | int x = numBytes; | ||
52 | |||
53 | DecodeProxyMessage(bytes, ref numBytes); | ||
54 | |||
55 | numBytes = x; | ||
56 | } | 50 | } |
57 | 51 | ||
58 | public static IPEndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes) | 52 | public static IPEndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes) |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index f37db36..629f513 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -219,18 +219,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
219 | } | 219 | } |
220 | 220 | ||
221 | EndPoint epProxy = null; | 221 | EndPoint epProxy = null; |
222 | 222 | ||
223 | // If we've received a use circuit packet, then we need to decode an endpoint proxy, if one exists, before | 223 | if (proxyPortOffset != 0) |
224 | // allowing the RecvBuffer to be overwritten by the next packet. | ||
225 | if (packet != null && packet.Type == PacketType.UseCircuitCode) | ||
226 | { | 224 | { |
227 | epProxy = epSender; | 225 | // If we've received a use circuit packet, then we need to decode an endpoint proxy, if one exists, |
228 | if (proxyPortOffset != 0) | 226 | // before allowing the RecvBuffer to be overwritten by the next packet. |
227 | if (packet != null && packet.Type == PacketType.UseCircuitCode) | ||
229 | { | 228 | { |
230 | epSender = ProxyCodec.DecodeProxyMessage(RecvBuffer, ref numBytes); | 229 | epProxy = epSender; |
231 | } | 230 | } |
231 | |||
232 | // Now decode the message from the proxy server | ||
233 | epSender = ProxyCodec.DecodeProxyMessage(RecvBuffer, ref numBytes); | ||
232 | } | 234 | } |
233 | 235 | ||
234 | BeginRobustReceive(); | 236 | BeginRobustReceive(); |
235 | 237 | ||
236 | if (packet != null) | 238 | if (packet != null) |
@@ -456,8 +458,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
456 | // ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) is just a failsafe to ensure that we don't overflow. | 458 | // ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) is just a failsafe to ensure that we don't overflow. |
457 | ack_it.Header.Sequence = ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) + 1; | 459 | ack_it.Header.Sequence = ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) + 1; |
458 | ack_it.Header.Reliable = false; | 460 | ack_it.Header.Reliable = false; |
459 | SendPacketTo(ack_it.ToBytes(), ack_it.ToBytes().Length, SocketFlags.None, useCircuit.CircuitCode.Code); | 461 | |
460 | 462 | byte[] ackmsg=ack_it.ToBytes(); | |
463 | |||
464 | // Need some extra space in case we need to add proxy | ||
465 | // information to the message later | ||
466 | byte[] msg = new byte[4096]; | ||
467 | Buffer.BlockCopy(ackmsg, 0, msg, 0, ackmsg.Length); | ||
468 | |||
469 | SendPacketTo(msg, ackmsg.Length, SocketFlags.None, useCircuit.CircuitCode.Code); | ||
470 | |||
461 | PacketPool.Instance.ReturnPacket(useCircuit); | 471 | PacketPool.Instance.ReturnPacket(useCircuit); |
462 | } | 472 | } |
463 | 473 | ||