Broadcast properly wraps the byte buffer (instead of unnecessary allocation)

This commit is contained in:
nathan 2019-06-14 03:14:22 +02:00
parent 050fa81aff
commit 4e0e95fb44

View File

@ -122,8 +122,7 @@ class Broadcast {
static
List<BroadcastResponse> discoverHosts0(Logger logger, int udpPort, int discoverTimeoutMillis, boolean fetchAllServers) throws IOException {
// fetch a buffer that contains the serialized object.
ByteBuf buffer = Unpooled.buffer(1);
buffer.writeByte(MagicBytes.broadcastID);
ByteBuf buffer = Unpooled.wrappedBuffer(new byte[]{MagicBytes.broadcastID});
List<BroadcastResponse> servers = new ArrayList<BroadcastResponse>();