mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-12-29 04:27:38 +01:00
Don't remove channel handlers in the main thread - can case deadlock.
This commit is contained in:
parent
8cb9e050a5
commit
be238f6ac6
@ -187,10 +187,20 @@ public abstract class TinyProtocol {
|
|||||||
public final void close() {
|
public final void close() {
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
closed = true;
|
closed = true;
|
||||||
|
// Compute this once
|
||||||
|
final String handlerName = getHandlerName();
|
||||||
|
|
||||||
// Remove our handlers
|
// Remove our handlers
|
||||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||||
getChannel(player).pipeline().remove(getHandlerName());
|
final Channel channel = getChannel(player);
|
||||||
|
|
||||||
|
// See ChannelInjector in ProtocolLib, line 590
|
||||||
|
channel.eventLoop().execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
channel.pipeline().remove(handlerName);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up Bukkit
|
// Clean up Bukkit
|
||||||
|
Loading…
Reference in New Issue
Block a user