Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Forgot a lock
Dieser Commit ist enthalten in:
Ursprung
ed196bdf99
Commit
47b15e5fef
@ -33,14 +33,15 @@ public abstract class AbstractProtocolDetectorService implements ProtocolDetecto
|
||||
public int serverProtocolVersion(final String serverName) {
|
||||
// Step 1. Check detected
|
||||
lock.readLock().lock();
|
||||
final int detectedProtocol;
|
||||
try {
|
||||
final int detectedProtocol = detectedProtocolIds.getInt(serverName);
|
||||
if (detectedProtocol != -1) {
|
||||
return detectedProtocol;
|
||||
}
|
||||
detectedProtocol = detectedProtocolIds.getInt(serverName);
|
||||
} finally {
|
||||
lock.readLock().unlock();
|
||||
}
|
||||
if (detectedProtocol != -1) {
|
||||
return detectedProtocol;
|
||||
}
|
||||
|
||||
// Step 2. Check config (CME moment?)
|
||||
final Map<String, Integer> servers = configuredServers();
|
||||
@ -81,6 +82,7 @@ public abstract class AbstractProtocolDetectorService implements ProtocolDetecto
|
||||
|
||||
@Override
|
||||
public Object2IntMap<String> detectedProtocolVersions() {
|
||||
lock.readLock().lock();
|
||||
try {
|
||||
return new Object2IntOpenHashMap<>(detectedProtocolIds);
|
||||
} finally {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren