Broadcast properly wraps the byte buffer (instead of unnecessary allocation)
This commit is contained in:
parent
050fa81aff
commit
4e0e95fb44
|
@ -122,8 +122,7 @@ class Broadcast {
|
||||||
static
|
static
|
||||||
List<BroadcastResponse> discoverHosts0(Logger logger, int udpPort, int discoverTimeoutMillis, boolean fetchAllServers) throws IOException {
|
List<BroadcastResponse> discoverHosts0(Logger logger, int udpPort, int discoverTimeoutMillis, boolean fetchAllServers) throws IOException {
|
||||||
// fetch a buffer that contains the serialized object.
|
// fetch a buffer that contains the serialized object.
|
||||||
ByteBuf buffer = Unpooled.buffer(1);
|
ByteBuf buffer = Unpooled.wrappedBuffer(new byte[]{MagicBytes.broadcastID});
|
||||||
buffer.writeByte(MagicBytes.broadcastID);
|
|
||||||
|
|
||||||
List<BroadcastResponse> servers = new ArrayList<BroadcastResponse>();
|
List<BroadcastResponse> servers = new ArrayList<BroadcastResponse>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user