Race condition that would occationally skip STATUS packets. Fixes 198
Dieser Commit ist enthalten in:
Ursprung
bf8c16e22d
Commit
ef4bd2ddcd
@ -101,7 +101,7 @@ public class NettyProtocolInjector implements ChannelListener {
|
|||||||
Object serverConnection = serverConnectionMethod.invoke(server);
|
Object serverConnection = serverConnectionMethod.invoke(server);
|
||||||
|
|
||||||
// Handle connected channels
|
// Handle connected channels
|
||||||
final ChannelInboundHandler initProtocol = new ChannelInitializer<Channel>() {
|
final ChannelInboundHandler endInitProtocol = new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel channel) throws Exception {
|
protected void initChannel(Channel channel) throws Exception {
|
||||||
try {
|
try {
|
||||||
@ -116,15 +116,24 @@ public class NettyProtocolInjector implements ChannelListener {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This is executed before Minecraft's channel handler
|
||||||
|
final ChannelInboundHandler beginInitProtocol = new ChannelInitializer<Channel>() {
|
||||||
|
@Override
|
||||||
|
protected void initChannel(Channel channel) throws Exception {
|
||||||
|
// Our only job is to add init protocol
|
||||||
|
channel.pipeline().addLast(endInitProtocol);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Add our handler to newly created channels
|
// Add our handler to newly created channels
|
||||||
final ChannelHandler connectionHandler = new ChannelInboundHandlerAdapter() {
|
final ChannelHandler connectionHandler = new ChannelInboundHandlerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
Channel channel = (Channel) msg;
|
Channel channel = (Channel) msg;
|
||||||
|
|
||||||
// Execute the other handlers before adding our own
|
// Prepare to initialize ths channel
|
||||||
|
channel.pipeline().addFirst(beginInitProtocol);
|
||||||
ctx.fireChannelRead(msg);
|
ctx.fireChannelRead(msg);
|
||||||
channel.pipeline().addLast(initProtocol);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren