commit 1f8c493937a624050a20c49b8f58bc72456591b2
parent add6c477acd0094cf8def01d9e7b3f1b41c90c57
Author: anon <anon@example.com>
Date: Sat, 7 Nov 2026 07:19:45 +0000
Remove redundant locks from mission owners and setup commands
Diffstat:
3 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/DEVELOPERS.md b/DEVELOPERS.md
@@ -814,7 +814,7 @@ its own temporary directory.
The test-only `/_test/player` snapshot exposes identity, placement, posture,
progress, resources and explicit carried-item records. Setup operations prepare
position, progress, grants, item placement/charges and a stationary picking
-target before the game connects. They use the server's locks and persistence
+target before the game connects. They execute on the current zone owner and use the ordinary persistence
methods; they do not accept SQL, arbitrary field names or internal struct dumps.
The test executable runs the same simulation loops and shutdown checkpoint as
the normal server. `e2e_api.go` and its entry point are excluded from default
diff --git a/server/e2e_api.go b/server/e2e_api.go
@@ -28,18 +28,10 @@ func (state *server) e2ePlayer(w http.ResponseWriter, r *http.Request) {
return
}
handle := func(owner *server, w http.ResponseWriter, r *http.Request) { owner.e2eOwnedPlayer(w, r, id) }
- if state.world != nil {
- state.servePlayerHTTP(w, r, id, handle)
- return
- }
- handle(state, w, r)
+ state.servePlayerHTTP(w, r, id, handle)
}
func (server *server) e2eOwnedPlayer(w http.ResponseWriter, r *http.Request, id uint32) {
- server.updateMutex.Lock()
- defer server.updateMutex.Unlock()
- server.mutex.Lock()
- defer server.mutex.Unlock()
player := server.characters[id]
if player == nil || player.browserTokenHash != browserCredential(r) {
http.Error(w, "a browser player is required", http.StatusUnauthorized)
@@ -73,7 +65,7 @@ func (server *server) e2eOwnedPlayer(w http.ResponseWriter, r *http.Request, id
return
}
if r.Method == "POST" {
- if err := server.e2eSetup_locked(player, r); err != nil {
+ if err := server.e2eSetup(player, r); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
@@ -102,7 +94,7 @@ func (server *server) e2eOwnedPlayer(w http.ResponseWriter, r *http.Request, id
json.NewEncoder(w).Encode(result)
}
-func (server *server) e2eSetup_locked(player *character, r *http.Request) error {
+func (server *server) e2eSetup(player *character, r *http.Request) error {
decoder := json.NewDecoder(r.Body)
decoder.DisallowUnknownFields()
switch r.PathValue("operation") {
diff --git a/server/world_mission_retirement.go b/server/world_mission_retirement.go
@@ -74,12 +74,8 @@ func (part *missionParticipant) retire(state *server, updates map[*worldClient][
}
func (part *missionParticipant) execute(state *server) error {
- state.updateMutex.Lock()
- defer state.updateMutex.Unlock()
- state.mutex.Lock()
updates := make(map[*worldClient][][]byte)
departures, err := part.retire(state, updates)
- state.mutex.Unlock()
if err != nil {
return err
}
@@ -103,13 +99,9 @@ func (command missionSourceCommand) execute(state *server) error {
return command.participant.retire(state, updates)
}
if command.operation.expired != nil {
- state.updateMutex.Lock()
- defer state.updateMutex.Unlock()
- state.mutex.Lock()
mission := *command.operation.expired
updates := make(map[*worldClient][][]byte)
departures, err := retire(mission, false, updates)
- state.mutex.Unlock()
if err != nil {
return err
}