Austin Jennings wrote:
I'm currently working on an application-level proxy library that sits
between the client and the server and allows applications to register
callbacks that inspect and modify packets as they pass through. Most
of the code is working, but I'm trying to deal with appended ACKs and
the code in NetworkManager is confusing and potentially broken:
private void OnReceivedData(IAsyncResult result)
...
// Retrieve the incoming packet
int numBytes =
Connection.EndReceiveFrom(result, ref endPoint);
if ((Buffer[Buffer.Length - 1] &
Helpers.MSG_APPENDED_ACKS) != 0)
{
// Grab the ACKs that are
appended to this packet
byte numAcks =
Buffer[Buffer.Length - 1];
Why is it looking at the last byte of the buffer instead of the first
byte for MSG_APPENDED_ACKS, and why is it reusing the same byte to
determine how many ACKs there are? If this is in fact wrong, is there
a way to determine how many ACKs there should be, short of calculating
the expected length of the packet and counting the number of extra
bytes on the end? Thanks.
-- Era Pixel
Oh damnit. Patch committed... thanks for the catch! Maybe that would
explain some of the networking oddities we've been having. It looks like
it was just that one check that was wrong (changed to Buffer[0] for the
initial check), but if you catch any other oddities let me know.
John
_______________________________________________
libsecondlife-dev mailing list
libsecondlife-dev@gna.org
https://mail.gna.org/listinfo/libsecondlife-dev