The region proxy for the load balancer module works again. The incoming proxy messages were not properly decoded.

0.6.1-post-fixes
Johan Berntsson 2008-11-10 09:50:05 +00:00
parent 0d02f53f87
commit 22b70495ab
2 changed files with 20 additions and 16 deletions

View File

@ -47,12 +47,6 @@ namespace OpenSim.Framework
{ {
bytes[numBytes++] = b; bytes[numBytes++] = b;
} }
int x = numBytes;
DecodeProxyMessage(bytes, ref numBytes);
numBytes = x;
} }
public static IPEndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes) public static IPEndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes)

View File

@ -219,18 +219,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
EndPoint epProxy = null; EndPoint epProxy = null;
// If we've received a use circuit packet, then we need to decode an endpoint proxy, if one exists, before if (proxyPortOffset != 0)
// allowing the RecvBuffer to be overwritten by the next packet.
if (packet != null && packet.Type == PacketType.UseCircuitCode)
{ {
epProxy = epSender; // If we've received a use circuit packet, then we need to decode an endpoint proxy, if one exists,
if (proxyPortOffset != 0) // before allowing the RecvBuffer to be overwritten by the next packet.
if (packet != null && packet.Type == PacketType.UseCircuitCode)
{ {
epSender = ProxyCodec.DecodeProxyMessage(RecvBuffer, ref numBytes); epProxy = epSender;
} }
// Now decode the message from the proxy server
epSender = ProxyCodec.DecodeProxyMessage(RecvBuffer, ref numBytes);
} }
BeginRobustReceive(); BeginRobustReceive();
if (packet != null) if (packet != null)
@ -456,8 +458,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) is just a failsafe to ensure that we don't overflow. // ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) is just a failsafe to ensure that we don't overflow.
ack_it.Header.Sequence = ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) + 1; ack_it.Header.Sequence = ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) + 1;
ack_it.Header.Reliable = false; ack_it.Header.Reliable = false;
SendPacketTo(ack_it.ToBytes(), ack_it.ToBytes().Length, SocketFlags.None, useCircuit.CircuitCode.Code);
byte[] ackmsg=ack_it.ToBytes();
// Need some extra space in case we need to add proxy
// information to the message later
byte[] msg = new byte[4096];
Buffer.BlockCopy(ackmsg, 0, msg, 0, ackmsg.Length);
SendPacketTo(msg, ackmsg.Length, SocketFlags.None, useCircuit.CircuitCode.Code);
PacketPool.Instance.ReturnPacket(useCircuit); PacketPool.Instance.ReturnPacket(useCircuit);
} }