mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-15 23:06:01 +01:00
25ecd402f3
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing BungeeCord Changes: 1a807731 #3567: Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.2 to 3.6.3 772ad995 #3566: Bump actions/setup-java from 3 to 4 2431c40a #3562: Bump io.netty:netty-bom from 4.1.100.Final to 4.1.101.Final 8144ae8d #3555: Bump com.mysql:mysql-connector-j from 8.1.0 to 8.2.0 0757c39a Attempt upgrade of resolver libraries
88 lines
4.4 KiB
Diff
88 lines
4.4 KiB
Diff
From 9431bb550c8ad9e18872691d9043dac347bb0ac6 Mon Sep 17 00:00:00 2001
|
|
From: kamcio96 <k.nadworski@icloud.com>
|
|
Date: Mon, 14 Mar 2016 16:07:20 -0700
|
|
Subject: [PATCH] Use a worker and a boss event loop group.
|
|
|
|
Merges the rest of https://github.com/SpigotMC/BungeeCord/pull/1706 by @kamcio96 along with b8845c4edbae46bb66f6adda338330a1d4032057
|
|
|
|
This is proper practice for netty.
|
|
|
|
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 e3eaee39..89ca9c63 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
@@ -120,7 +120,7 @@ public class BungeeCord extends ProxyServer
|
|
* Localization formats.
|
|
*/
|
|
private Map<String, Format> messageFormats;
|
|
- public EventLoopGroup eventLoops;
|
|
+ public EventLoopGroup bossEventLoopGroup, workerEventLoopGroup;
|
|
/**
|
|
* locations.yml save thread.
|
|
*/
|
|
@@ -270,7 +270,8 @@ public class BungeeCord extends ProxyServer
|
|
ResourceLeakDetector.setLevel( ResourceLeakDetector.Level.DISABLED ); // Eats performance
|
|
}
|
|
|
|
- eventLoops = PipelineUtils.newEventLoopGroup( 0, new ThreadFactoryBuilder().setNameFormat( "Netty IO Thread #%1$d" ).build() );
|
|
+ bossEventLoopGroup = PipelineUtils.newEventLoopGroup( 0, new ThreadFactoryBuilder().setNameFormat( "Netty Boss IO Thread #%1$d" ).build() );
|
|
+ workerEventLoopGroup = PipelineUtils.newEventLoopGroup( 0, new ThreadFactoryBuilder().setNameFormat( "Netty Worker IO Thread #%1$d" ).build() );
|
|
|
|
File moduleDirectory = new File( "modules" );
|
|
moduleManager.load( this, moduleDirectory );
|
|
@@ -359,7 +360,7 @@ public class BungeeCord extends ProxyServer
|
|
.option( ChannelOption.SO_REUSEADDR, true ) // TODO: Move this elsewhere!
|
|
.childAttr( PipelineUtils.LISTENER, info )
|
|
.childHandler( PipelineUtils.SERVER_CHILD )
|
|
- .group( eventLoops )
|
|
+ .group( bossEventLoopGroup, workerEventLoopGroup )
|
|
.localAddress( info.getSocketAddress() )
|
|
.bind().addListener( listener );
|
|
|
|
@@ -382,7 +383,7 @@ public class BungeeCord extends ProxyServer
|
|
}
|
|
}
|
|
};
|
|
- new RemoteQuery( this, info ).start( PipelineUtils.getDatagramChannel(), new InetSocketAddress( info.getHost().getAddress(), info.getQueryPort() ), eventLoops, bindListener );
|
|
+ new RemoteQuery( this, info ).start( PipelineUtils.getDatagramChannel(), new InetSocketAddress( info.getHost().getAddress(), info.getQueryPort() ), workerEventLoopGroup, bindListener );
|
|
}
|
|
}
|
|
}
|
|
@@ -491,12 +492,14 @@ public class BungeeCord extends ProxyServer
|
|
}
|
|
|
|
getLogger().info( "Closing IO threads" );
|
|
- eventLoops.shutdownGracefully();
|
|
- try
|
|
- {
|
|
- eventLoops.awaitTermination( Long.MAX_VALUE, TimeUnit.NANOSECONDS );
|
|
- } catch ( InterruptedException ex )
|
|
- {
|
|
+ bossEventLoopGroup.shutdownGracefully();
|
|
+ workerEventLoopGroup.shutdownGracefully();
|
|
+ while (true) {
|
|
+ try {
|
|
+ bossEventLoopGroup.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
|
|
+ workerEventLoopGroup.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
|
|
+ break;
|
|
+ } catch (InterruptedException ignored) {}
|
|
}
|
|
|
|
getLogger().info( "Thank you and goodbye" );
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java
|
|
index 671cf96f..377df7ec 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java
|
|
@@ -185,7 +185,7 @@ public class BungeeServerInfo implements ServerInfo
|
|
};
|
|
new Bootstrap()
|
|
.channel( PipelineUtils.getChannel( socketAddress ) )
|
|
- .group( BungeeCord.getInstance().eventLoops )
|
|
+ .group( BungeeCord.getInstance().workerEventLoopGroup )
|
|
.handler( PipelineUtils.BASE_SERVERSIDE )
|
|
.option( ChannelOption.CONNECT_TIMEOUT_MILLIS, BungeeCord.getInstance().getConfig().getRemotePingTimeout() )
|
|
.remoteAddress( socketAddress )
|
|
--
|
|
2.43.0
|
|
|