Make sure packets are written before closing
This commit is contained in:
parent
55c2bcd634
commit
475571986c
@ -42,6 +42,7 @@ public class ServerConnection implements Server
|
|||||||
{
|
{
|
||||||
if ( !ch.isClosed() )
|
if ( !ch.isClosed() )
|
||||||
{
|
{
|
||||||
|
// TODO: Can we just use a future here?
|
||||||
unsafe().sendPacket( new PacketFFKick( reason ) );
|
unsafe().sendPacket( new PacketFFKick( reason ) );
|
||||||
ch.getHandle().eventLoop().schedule( new Runnable()
|
ch.getHandle().eventLoop().schedule( new Runnable()
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,8 @@ package net.md_5.bungee.netty;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelFuture;
|
||||||
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.MessageList;
|
import io.netty.channel.MessageList;
|
||||||
@ -50,9 +52,15 @@ public class ChannelWrapper
|
|||||||
if ( !closed )
|
if ( !closed )
|
||||||
{
|
{
|
||||||
closed = true;
|
closed = true;
|
||||||
ch.write( queue );
|
ch.write( queue, ch.newPromise() ).addListener( new ChannelFutureListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void operationComplete(ChannelFuture future) throws Exception
|
||||||
|
{
|
||||||
ch.close();
|
ch.close();
|
||||||
}
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBefore(String baseName, String name, ChannelHandler handler)
|
public void addBefore(String baseName, String name, ChannelHandler handler)
|
||||||
|
Loading…
Reference in New Issue
Block a user