mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 21:01:02 -05:00
Ensure channel is set before returning from bind().
This commit is contained in:
parent
ce140f43d6
commit
9c1ac6aa9b
1 changed files with 17 additions and 12 deletions
|
@ -87,7 +87,18 @@ public class TcpConnectionListener implements ConnectionListener {
|
|||
|
||||
server.addSession(session);
|
||||
}
|
||||
}).group(this.group).localAddress(this.host, this.port).bind().addListener(new ChannelFutureListener() {
|
||||
}).group(this.group).localAddress(this.host, this.port).bind();
|
||||
|
||||
if(wait) {
|
||||
try {
|
||||
future.sync();
|
||||
} catch(InterruptedException e) {
|
||||
}
|
||||
|
||||
channel = future.channel();
|
||||
callback.run();
|
||||
} else {
|
||||
future.addListener(new ChannelFutureListener() {
|
||||
@Override
|
||||
public void operationComplete(ChannelFuture channelFuture) throws Exception {
|
||||
if(channelFuture.isSuccess()) {
|
||||
|
@ -99,12 +110,6 @@ public class TcpConnectionListener implements ConnectionListener {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(wait) {
|
||||
try {
|
||||
future.sync();
|
||||
} catch(InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue