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;
}
int x = numBytes;
DecodeProxyMessage(bytes, ref numBytes);
numBytes = x;
}
public static IPEndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes)

View File

@ -220,15 +220,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
EndPoint epProxy = null;
// If we've received a use circuit packet, then we need to decode an endpoint proxy, if one exists, before
// allowing the RecvBuffer to be overwritten by the next packet.
if (packet != null && packet.Type == PacketType.UseCircuitCode)
if (proxyPortOffset != 0)
{
epProxy = epSender;
if (proxyPortOffset != 0)
// If we've received a use circuit packet, then we need to decode an endpoint proxy, if one exists,
// 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();
@ -456,7 +458,15 @@ 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.
ack_it.Header.Sequence = ((useCircuit.Header.Sequence < uint.MaxValue) ? useCircuit.Header.Sequence : 0) + 1;
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);
}