From c1bdbef9cfdfd1d66d12eb73af296fc253e80cd7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 16 Jan 2017 10:00:27 +1100 Subject: [PATCH] Give delayed close packets time to send on /end --- proxy/src/main/java/net/md_5/bungee/BungeeCord.java | 7 +++++++ .../main/java/net/md_5/bungee/netty/ChannelWrapper.java | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 159dab67..9fdb4c76 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -391,6 +391,13 @@ public class BungeeCord extends ProxyServer connectionLock.readLock().unlock(); } + try + { + Thread.sleep( 500 ); + } catch ( InterruptedException ex ) + { + } + getLogger().info( "Closing IO threads" ); eventLoops.shutdownGracefully(); try diff --git a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java index 0b0dd736..254c4717 100644 --- a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java +++ b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java @@ -75,7 +75,7 @@ public class ChannelWrapper // Minecraft client can take some time to switch protocols. // Sending the wrong disconnect packet whilst a protocol switch is in progress will crash it. - // Delay 500ms to ensure that the protocol switch (if any) has definitely taken place. + // Delay 250ms to ensure that the protocol switch (if any) has definitely taken place. ch.eventLoop().schedule( new Runnable() { @@ -90,7 +90,7 @@ public class ChannelWrapper ChannelWrapper.this.close(); } } - }, 500, TimeUnit.MILLISECONDS ); + }, 250, TimeUnit.MILLISECONDS ); } }