3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-08-11 19:08:33 +02:00
Ursprung ed196bdf99
Commit 47b15e5fef
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -33,14 +33,15 @@ public abstract class AbstractProtocolDetectorService implements ProtocolDetecto
public int serverProtocolVersion(final String serverName) { public int serverProtocolVersion(final String serverName) {
// Step 1. Check detected // Step 1. Check detected
lock.readLock().lock(); lock.readLock().lock();
final int detectedProtocol;
try { try {
final int detectedProtocol = detectedProtocolIds.getInt(serverName); detectedProtocol = detectedProtocolIds.getInt(serverName);
if (detectedProtocol != -1) {
return detectedProtocol;
}
} finally { } finally {
lock.readLock().unlock(); lock.readLock().unlock();
} }
if (detectedProtocol != -1) {
return detectedProtocol;
}
// Step 2. Check config (CME moment?) // Step 2. Check config (CME moment?)
final Map<String, Integer> servers = configuredServers(); final Map<String, Integer> servers = configuredServers();
@ -81,6 +82,7 @@ public abstract class AbstractProtocolDetectorService implements ProtocolDetecto
@Override @Override
public Object2IntMap<String> detectedProtocolVersions() { public Object2IntMap<String> detectedProtocolVersions() {
lock.readLock().lock();
try { try {
return new Object2IntOpenHashMap<>(detectedProtocolIds); return new Object2IntOpenHashMap<>(detectedProtocolIds);
} finally { } finally {