mas-bandwidth / yojimbo

A network library for client/server games written in C++
BSD 3-Clause "New" or "Revised" License
2.45k stars 238 forks source link

Expose `GetClientUserData` on YojimboServer class. Fix address serialization bug in matcher code. #201

Closed kbirk closed 2 months ago

kbirk commented 2 months ago

Hey there. I noticed there was no method exposed for that in yojimbo to access the userdata inside the connection token, so I added one.

I also noticed that my userdata bytes were "shifted" and including the trailing 12 bytes of the ServerToClientKey . After some debugging I realized that the writeAddresses function in the matcher code always increments the offset by 19, whether it is IPV4 or IPV6, but netcode it reads only as many bytes as needed. So I fixed that too.

Cheers

gafferongames commented 2 months ago

Thanks! Can you please look into why macOS is not building?

gafferongames commented 2 months ago

I can take a look at it as well. It's curious, and doesn't seem to be triggered by your change?

kbirk commented 2 months ago

Yeah my change really shouldn't affect the CI. I'm wondering if it is because macos-latest uses apple silicon now: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners

Looks like that was it , I added libdirs { "/opt/homebrew/lib" } to the premake file and that seems to have fixed it.

gafferongames commented 2 months ago

Bingo. Nice one