mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 17:23:44 +00:00
feat(multiplayer): bind admissions to durable leases
This commit is contained in:
@@ -78,7 +78,10 @@ func ClaimPlayerConnection(ctx context.Context, db *sql.DB, binding domain.Workl
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if current != expectedGeneration || expectedGeneration == ^uint64(0) {
|
||||
// A fresh process has no in-memory generation. It may recover only a
|
||||
// durably disconnected lease; an active row still fences it. All
|
||||
// nonzero expectations remain exact CAS operations.
|
||||
if (current != expectedGeneration && !(expectedGeneration == 0 && current > 0 && disconnectedAt.Valid)) || expectedGeneration == ^uint64(0) {
|
||||
return domain.ErrConflict
|
||||
}
|
||||
if current == 0 {
|
||||
|
||||
Reference in New Issue
Block a user