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) {
|
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 {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren