Remove computers from both lookups when they timeout

In 5d8c46c7e6, we switched to using UUIDs
for looking up computers (rather than an integer ID). However, for
compatibility in some of the command code, we need to maintain the old
integer lookup map.

Most of the code was updated to handle this, *except* the code to remove
a computer from the registry. This meant that we'd fail to remove a
computer from the UUID lookup map, so computers ended up in a phantom
state where they were destroyed, but still accessible.

This is not an issue on 1.20.4, because the legacy int lookup map was
removed.

Fixes #1760
This commit is contained in:
Jonathan Coates 2024-03-23 10:58:46 +00:00
parent 57c72711bb
commit 286f969f94
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
1 changed files with 2 additions and 1 deletions

View File

@ -42,13 +42,14 @@ public ServerComputer get(int sessionId, @Nullable UUID instanceId) {
}
void update() {
var it = getComputers().iterator();
var it = computersByInstanceId.values().iterator();
while (it.hasNext()) {
var computer = it.next();
if (computer.hasTimedOut()) {
computer.unload();
computer.onRemoved();
it.remove();
computersByInstanceUuid.remove(computer.getInstanceUUID());
} else {
computer.tickServer();
}