Run closeWith() logic in the event loop
This commit is contained in:
@@ -205,8 +205,10 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
|
|||||||
*/
|
*/
|
||||||
public void closeWith(Object msg) {
|
public void closeWith(Object msg) {
|
||||||
if (channel.isActive()) {
|
if (channel.isActive()) {
|
||||||
knownDisconnect = true;
|
channel.eventLoop().execute(() -> {
|
||||||
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
|
knownDisconnect = true;
|
||||||
|
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user