{"action":"created","issue":{"url":"https://api.github.com/repos/lsalzman/enet/issues/41","labels_url":"https://api.github.com/repos/lsalzman/enet/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/lsalzman/enet/issues/41/comments","events_url":"https://api.github.com/repos/lsalzman/enet/issues/41/events","html_url":"https://github.com/lsalzman/enet/issues/41","id":55379152,"number":41,"title":"Increasing ENET_PROTOCOL_MAXIMUM_PEER_ID beyond 4096","user":{"login":"Sempran","id":10686966,"avatar_url":"https://avatars.githubusercontent.com/u/10686966?v=3","gravatar_id":"","url":"https://api.github.com/users/Sempran","html_url":"https://github.com/Sempran","followers_url":"https://api.github.com/users/Sempran/followers","following_url":"https://api.github.com/users/Sempran/following{/other_user}","gists_url":"https://api.github.com/users/Sempran/gists{/gist_id}","starred_url":"https://api.github.com/users/Sempran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sempran/subscriptions","organizations_url":"https://api.github.com/users/Sempran/orgs","repos_url":"https://api.github.com/users/Sempran/repos","events_url":"https://api.github.com/users/Sempran/events{/privacy}","received_events_url":"https://api.github.com/users/Sempran/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-01-24T17:58:28Z","updated_at":"2015-02-08T19:09:56Z","closed_at":null,"body":"The maximum value ENet can take for ENET_PROTOCOL_MAXIMUM_PEER_ID appears to be the default of 0xFFF, enforcing a maximum concurrent value of 4096 users, despite this field being a UINT 16 with a theoretical maximum of 65536. This is probably related to the fact the field is reused to store some header flags, ENET_PROTOCOL_HEADER_FLAG_SENT_TIME on bit 16 and ENET_PROTOCOL_HEADER_FLAG_COMPRESSED on bit 15. But this still leaves us with 14 bits, although for some reason it doesn't work with 2^14 bytes either, only with 2^12, so I'm thinking it also has anything to do with ENET_PROTOCOL_HEADER_SESSION_SHIFT which is set to 12.\r\n\r\nA little guidance would be appreciated about how to go about increasing the limit, I could tinker myself and figure it out but I'm scared of introducing any potential security exploits.\r\n\r\nOnce it's done, is there any possibility a patch that uses a 32-bit peer id could be incorporated? There could be a define MASS_PEERS_MODE that allows you to have more peers.\r\n\r\nNowadays a single server can easily take tens of thousands of clients, so I think this limitation is a big problem."},"comment":{"url":"https://api.github.com/repos/lsalzman/enet/issues/comments/73425935","html_url":"https://github.com/lsalzman/enet/issues/41#issuecomment-73425935","issue_url":"https://api.github.com/repos/lsalzman/enet/issues/41","id":73425935,"user":{"login":"pisto","id":489967,"avatar_url":"https://avatars.githubusercontent.com/u/489967?v=3","gravatar_id":"","url":"https://api.github.com/users/pisto","html_url":"https://github.com/pisto","followers_url":"https://api.github.com/users/pisto/followers","following_url":"https://api.github.com/users/pisto/following{/other_user}","gists_url":"https://api.github.com/users/pisto/gists{/gist_id}","starred_url":"https://api.github.com/users/pisto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pisto/subscriptions","organizations_url":"https://api.github.com/users/pisto/orgs","repos_url":"https://api.github.com/users/pisto/repos","events_url":"https://api.github.com/users/pisto/events{/privacy}","received_events_url":"https://api.github.com/users/pisto/received_events","type":"User","site_admin":false},"created_at":"2015-02-08T19:09:55Z","updated_at":"2015-02-08T19:09:55Z","body":"@Sempran if I remember correctly there's no counter in vanilla enet that keeps track of how many peers are connected, so it loops on all the available peers. Also I implemented peerID randomization for security purposes, hence I need to keep a list of connected and unconnected peers."}}