Database: Limit user ID to signed 32-bit limit

This commit is contained in:
mkwcat 2024-01-23 18:09:04 -05:00
parent 07d8f3d079
commit 659ec8d5e1
No known key found for this signature in database
GPG Key ID: 7A505679CE9E7AA9

View File

@ -104,7 +104,9 @@ func (user *User) UpdateDeviceID(pool *pgxpool.Pool, ctx context.Context, newDev
func GetUniqueUserID() uint64 {
// Not guaranteed unique but doesn't matter in practice if multiple people have the same user ID.
return uint64(rand.Int63n(0x80000000000))
// The maximum size here is 0x80000000000, but older DS games have a bug causing connection issues
// if the user ID is greater than the signed 32-bit limit.
return uint64(rand.Int63n(0x80000000))
}
func (user *User) UpdateProfile(pool *pgxpool.Pool, ctx context.Context, data map[string]string) {