feat(multiplayer): bind admissions to durable leases

This commit is contained in:
Josh Creek
2026-09-03 13:45:39 +01:00
parent 3e0022ce9c
commit aac81c89b6
9 changed files with 301 additions and 64 deletions
+4 -1
View File
@@ -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 {