fivem icon indicating copy to clipboard operation
fivem copied to clipboard

tweak(net): generate truly random "GUID"'s

Open AvarianKnight opened this issue 8 months ago • 2 comments

Goal of this PR

This is old code that only gets used on initial client connection in cases where the peer doesn't match the same TCP peer (for situations like Cloudflare Warp or other VPN's that don't keep TCP/UDP the same)

This ID previously allowed for someone to get disconnected if they had the unfortunate coincidence of having the same tick time as another player on initial join, and while this happened rarely, it still happened.

This makes the GUID a "more random" number, and in situations where the GUID will collide it will drop the connecting client instead of the existing client. Since the GUID gets incremented on every join, there will be no valid collisions anyways.

This PR applies to the following area(s)

FiveM, RedM, Server

Successfully tested on

Game builds: ..

Platforms: Windows, Linux

Checklist

  • [x] Code compiles and has been tested successfully.
  • [x] Code explains itself well and/or is documented.
  • [x] My commit message explains what the changes do and what they are for.
  • [x] No extra compilation warnings are added by these changes.

AvarianKnight avatar Apr 17 '25 03:04 AvarianKnight

Simple, but effective. Approved.

dalekenium-cfx avatar Apr 24 '25 14:04 dalekenium-cfx

Needs additional review to ensure it doesn't break some of our internal/closed-source logic.

neptunium-cfx avatar Apr 24 '25 14:04 neptunium-cfx