mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-10 09:20:28 +00:00
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:
parent
57c72711bb
commit
286f969f94
@ -42,13 +42,14 @@ public class ServerComputerRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void update() {
|
void update() {
|
||||||
var it = getComputers().iterator();
|
var it = computersByInstanceId.values().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
var computer = it.next();
|
var computer = it.next();
|
||||||
if (computer.hasTimedOut()) {
|
if (computer.hasTimedOut()) {
|
||||||
computer.unload();
|
computer.unload();
|
||||||
computer.onRemoved();
|
computer.onRemoved();
|
||||||
it.remove();
|
it.remove();
|
||||||
|
computersByInstanceUuid.remove(computer.getInstanceUUID());
|
||||||
} else {
|
} else {
|
||||||
computer.tickServer();
|
computer.tickServer();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user