From 3e0df79c986a6cc1a0717ec30808ed410ee602d3 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 7 Aug 2018 07:34:41 -0400 Subject: [PATCH] Fix GS4 "can't bind to null" error. --- .../com/velocitypowered/network/ConnectionManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/network/ConnectionManager.java b/proxy/src/main/java/com/velocitypowered/network/ConnectionManager.java index 851eda878..ab5853bc3 100644 --- a/proxy/src/main/java/com/velocitypowered/network/ConnectionManager.java +++ b/proxy/src/main/java/com/velocitypowered/network/ConnectionManager.java @@ -128,19 +128,19 @@ public final class ConnectionManager { } public void queryBind(final String hostname, final int port) { - new Bootstrap() + Bootstrap bootstrap = new Bootstrap() .channel(datagramChannelClass) .group(this.workerGroup) .handler(new GS4QueryHandler()) - .localAddress(hostname, port) - .bind() + .localAddress(hostname, port); + bootstrap.bind() .addListener((ChannelFutureListener) future -> { final Channel channel = future.channel(); if (future.isSuccess()) { this.endpoints.add(channel); logger.info("Listening for GS4 query on {}", channel.localAddress()); } else { - logger.error("Can't bind to {}", channel.localAddress(), future.cause()); + logger.error("Can't bind to {}", bootstrap.config().localAddress(), future.cause()); } }); }