raduprv / Eternal-Lands

http://www.eternal-lands.com
Other
157 stars 57 forks source link

PING_REQUEST #151

Open gvissers opened 2 years ago

gvissers commented 2 years ago

In process_message_from_server(), a PING_REQUEST from the server is handled as

            // just send the pack back as it is
            my_tcp_send(in_data, data_length);

But this doesn't send the exact same package back, as in_data at that point contains the packet length, and my_tcp_send() will insert a new one. The resulting package that gets sent back thus looks like

{
    PING_REQUEST: u8,
    7: u16 , // (length = 1 byte opcode + 2 bytes old length + timestamp)
    5: u16,  // (incoming length as sent from server)
    timestamp: u32
}

I am assuming this is a bug, but it has been like that for a long time, so I'm checking if that's true. @raduprv , can you confirm that this needs fixing? (and if so, you must be getting some pretty wild ping times :D)