teeworlds / teeworlds

A retro multiplayer shooter
https://www.teeworlds.com
Other
2.36k stars 637 forks source link

64 players: ServerInfo might be too big #2135

Open nheir opened 5 years ago

nheir commented 5 years ago

The ServerInfo packet size can be greater than the the max allowed packet size. Basically, a ServerInfo packet is composed by :

 - header                 (18)
   - packet flags (1)
   - client token (4)
   - server token (4)
   - request data (8)
   - null byte    (1)
 - server properties (max 410)
   - version       (max 32)
   - name          (max 64)
   - hostname     (max 256)
   - map           (max 32)
   - gametype      (max 16)
   - password flag      (1)
   - skill level        (1)
   - num_player     (max 2)
   - max_player     (max 2)
   - num_client     (max 2)
   - max_client     (max 2)
 - player info        (max 120) x64
   - name    (max 64)
   - clan    (max 48)
   - country  (max 2)
   - score    (max 5)
   - flag         (1)

Total: max 8108 >> 1400

Step to reproduce: Fill a 64 clients server with player names and clan names of max size. [netserver]: packet payload too big. 2035. dropping packet

Edit: updated with respect to https://github.com/teeworlds/teeworlds/commit/5aebb3061f807c00d4051bc439e48029ed40e902

heinrich5991 commented 5 years ago

DDNet solves this by sending multiple packets: https://github.com/ddnet/ddnet/pull/322, serverinfo_extended.md.

heinrich5991 commented 4 years ago

This is now excarbated by the implementation of #2741. Player/clan names can be as long as 64 bytes, so you can't even reliably fit 16 players into the server info packet.