Archiviert
13
0

Try a less expensive map impl for packet markers

This might be a concurrency nightmare or a nice solution. I'm hopeful
based on initial testing
Addresses #489
Dieser Commit ist enthalten in:
Dan Mulloy 2018-07-09 22:32:21 -04:00
Ursprung c9dd6e2ba7
Commit 5048f6f34b

Datei anzeigen

@ -21,7 +21,6 @@ import java.net.SocketAddress;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType;
@ -45,7 +44,6 @@ import com.comphenix.protocol.utility.MinecraftProtocolVersion;
import com.comphenix.protocol.utility.MinecraftReflection; import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.wrappers.WrappedGameProfile; import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.MapMaker;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.*; import io.netty.channel.*;
@ -115,7 +113,7 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
private VolatileField channelField; private VolatileField channelField;
// Known network markers // Known network markers
private ConcurrentMap<Object, NetworkMarker> packetMarker = new MapMaker().weakKeys().makeMap(); private Map<Object, NetworkMarker> packetMarker = new WeakHashMap<>();
/** /**
* Indicate that this packet has been processed by event listeners. * Indicate that this packet has been processed by event listeners.