Waterfall/BungeeCord-Patches/0027-Add-timeout-variant-to-connect-methods.patch

114 lines
5.7 KiB
Diff
Raw Normal View History

Updated Upstream (BungeeCord) 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: 5a1e342e Minecraft 1.20.2 support d9bbdc32 Add Java 21 compilation support cfe00fa4 #3490: Add ComponentBuilder#build() and ComponentSerializer#deserialize() d68ebd1e Minecraft 1.20.2-rc1 support a7cd79eb #3516: Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.5.0 to 3.6.0 9e83ee6f #3508: Use same compression threshold checks as Vanilla 7c81d917 #3513: Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.4.0 to 3.4.1 5b126b7f Fix javadoc plugin version in non-dist builds 9fe7d21f #3510: Bump actions/checkout from 3 to 4 94ea0271 #3505: Bump io.netty:netty-bom from 4.1.96.Final to 4.1.97.Final 3af672d2 #3504: Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.3.0 to 3.4.0 0dd7b984 Bump version to 1.20-R0.2-SNAPSHOT a793692a Release 1.20-R0.1 23fb8382 #3493: Bump io.netty:netty-bom from 4.1.95.Final to 4.1.96.Final 2d6d89d6 #3492: Bump io.netty:netty-bom from 4.1.94.Final to 4.1.95.Final 0199cb90 #3489: Add command string length limit when decoding ClientCommand 958cef50 #3488: Bump scriptus from 0.4.1 to 0.5.0 9f5ace90 #3418: Add tab completion for bungee command names in pre-1.13 versions 3a6e2631 #3479: Bump netty-bom from 4.1.93.Final to 4.1.94.Final c7adcf9f Disable maven enforcer for now da3616e6 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends b371fe67 #3478: Bump maven-shade-plugin from 3.4.1 to 3.5.0 6324c7d5 #3401: Only synchronize necessary parts of the BungeeServerInfo#sendData method 6263fe28 #3426: Made find command output hover and clickable 9a7617f9 #3475: Add KickPlayerRaw channel 9a71358d #3439: Add GetPlayerServer bungee plugin message subchannel a96a2e80 #3437: Remove unused enum in ServerConnector and add color to exception message
2023-09-21 18:59:49 +02:00
From 964bf7b3cf1b45a82b8ab24689bed4cbd549b968 Mon Sep 17 00:00:00 2001
2016-07-03 10:07:00 +02:00
From: Ichbinjoe <joe@ibj.io>
Date: Sat, 16 Jul 2016 20:44:01 -0400
2016-07-03 22:53:51 +02:00
Subject: [PATCH] Add timeout variant to connect methods
2016-07-03 10:07:00 +02:00
2016-07-03 22:53:51 +02:00
Also added more connect methods to ProxiedPlayer, in addition to the new method
2016-07-03 10:07:00 +02:00
diff --git a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java
2023-09-21 12:33:23 +02:00
index c3848b3c..a441a424 100644
2016-07-03 10:07:00 +02:00
--- a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java
+++ b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java
@@ -126,6 +126,38 @@ public interface ProxiedPlayer extends Connection, CommandSender
2016-07-03 10:07:00 +02:00
*/
void connect(ServerInfo target, Callback<Boolean> callback);
+ // Waterfall start
+ /**
+ * Connects / transfers this user to the specified connection, gracefully
+ * closing the current one. Depending on the implementation, this method
+ * might return before the user has been connected.
+ *
+ * @param target the new server to connect to
+ * @param callback the method called when the connection is complete, or
+ * when an exception is encountered. The boolean parameter denotes success
+ * or failure.
+ * @param retry whether to retry the connection if the initial connection
+ * fails.
+ */
+ void connect(ServerInfo target, Callback<Boolean> callback, boolean retry);
+
+ /**
+ * Connects / transfers this user to the specified connection, gracefully
+ * closing the current one. Depending on the implementation, this method
+ * might return before the user has been connected.
+ *
+ * @param target the new server to connect to
+ * @param callback the method called when the connection is complete, or
+ * when an exception is encountered. The boolean parameter denotes success
+ * or failure.
+ * @param retry whether to retry the connection if the initial connection
+ * fails.
+ * @param timeout timeout in milliseconds of the connection created to the
+ * target server
+ */
+ void connect(ServerInfo target, Callback<Boolean> callback, boolean retry, int timeout);
+ // Waterfall end
2018-04-02 11:21:24 +02:00
+
/**
* Connects / transfers this user to the specified connection, gracefully
* closing the current one. Depending on the implementation, this method
@@ -139,6 +171,25 @@ public interface ProxiedPlayer extends Connection, CommandSender
2018-04-02 11:21:24 +02:00
*/
void connect(ServerInfo target, Callback<Boolean> callback, ServerConnectEvent.Reason reason);
+ // Waterfall start
+ /**
+ * Connects / transfers this user to the specified connection, gracefully
+ * closing the current one. Depending on the implementation, this method
+ * might return before the user has been connected.
+ *
+ * @param target the new server to connect to
+ * @param callback the method called when the connection is complete, or
+ * when an exception is encountered. The boolean parameter denotes success
+ * or failure.
+ * @param retry whether to retry the connection if the initial connection
+ * fails.
+ * @param reason the reason for connecting to the new server
+ * @param timeout timeout in milliseconds of the connection created to the
+ * target server
+ */
+ void connect(ServerInfo target, Callback<Boolean> callback, boolean retry, ServerConnectEvent.Reason reason, int timeout);
+ // Waterfall end
2016-07-03 10:07:00 +02:00
+
/**
2018-07-30 13:54:15 +02:00
* Connects / transfers this user to the specified connection, gracefully
* closing the current one. Depending on the implementation, this method
2016-07-03 10:07:00 +02:00
diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
Updated Upstream (BungeeCord) 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: 5a1e342e Minecraft 1.20.2 support d9bbdc32 Add Java 21 compilation support cfe00fa4 #3490: Add ComponentBuilder#build() and ComponentSerializer#deserialize() d68ebd1e Minecraft 1.20.2-rc1 support a7cd79eb #3516: Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.5.0 to 3.6.0 9e83ee6f #3508: Use same compression threshold checks as Vanilla 7c81d917 #3513: Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.4.0 to 3.4.1 5b126b7f Fix javadoc plugin version in non-dist builds 9fe7d21f #3510: Bump actions/checkout from 3 to 4 94ea0271 #3505: Bump io.netty:netty-bom from 4.1.96.Final to 4.1.97.Final 3af672d2 #3504: Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.3.0 to 3.4.0 0dd7b984 Bump version to 1.20-R0.2-SNAPSHOT a793692a Release 1.20-R0.1 23fb8382 #3493: Bump io.netty:netty-bom from 4.1.95.Final to 4.1.96.Final 2d6d89d6 #3492: Bump io.netty:netty-bom from 4.1.94.Final to 4.1.95.Final 0199cb90 #3489: Add command string length limit when decoding ClientCommand 958cef50 #3488: Bump scriptus from 0.4.1 to 0.5.0 9f5ace90 #3418: Add tab completion for bungee command names in pre-1.13 versions 3a6e2631 #3479: Bump netty-bom from 4.1.93.Final to 4.1.94.Final c7adcf9f Disable maven enforcer for now da3616e6 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends b371fe67 #3478: Bump maven-shade-plugin from 3.4.1 to 3.5.0 6324c7d5 #3401: Only synchronize necessary parts of the BungeeServerInfo#sendData method 6263fe28 #3426: Made find command output hover and clickable 9a7617f9 #3475: Add KickPlayerRaw channel 9a71358d #3439: Add GetPlayerServer bungee plugin message subchannel a96a2e80 #3437: Remove unused enum in ServerConnector and add color to exception message
2023-09-21 18:59:49 +02:00
index 65e942cd..87eb9199 100644
2016-07-03 10:07:00 +02:00
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
Updated Upstream (BungeeCord) 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: 5a1e342e Minecraft 1.20.2 support d9bbdc32 Add Java 21 compilation support cfe00fa4 #3490: Add ComponentBuilder#build() and ComponentSerializer#deserialize() d68ebd1e Minecraft 1.20.2-rc1 support a7cd79eb #3516: Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.5.0 to 3.6.0 9e83ee6f #3508: Use same compression threshold checks as Vanilla 7c81d917 #3513: Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.4.0 to 3.4.1 5b126b7f Fix javadoc plugin version in non-dist builds 9fe7d21f #3510: Bump actions/checkout from 3 to 4 94ea0271 #3505: Bump io.netty:netty-bom from 4.1.96.Final to 4.1.97.Final 3af672d2 #3504: Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.3.0 to 3.4.0 0dd7b984 Bump version to 1.20-R0.2-SNAPSHOT a793692a Release 1.20-R0.1 23fb8382 #3493: Bump io.netty:netty-bom from 4.1.95.Final to 4.1.96.Final 2d6d89d6 #3492: Bump io.netty:netty-bom from 4.1.94.Final to 4.1.95.Final 0199cb90 #3489: Add command string length limit when decoding ClientCommand 958cef50 #3488: Bump scriptus from 0.4.1 to 0.5.0 9f5ace90 #3418: Add tab completion for bungee command names in pre-1.13 versions 3a6e2631 #3479: Bump netty-bom from 4.1.93.Final to 4.1.94.Final c7adcf9f Disable maven enforcer for now da3616e6 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends b371fe67 #3478: Bump maven-shade-plugin from 3.4.1 to 3.5.0 6324c7d5 #3401: Only synchronize necessary parts of the BungeeServerInfo#sendData method 6263fe28 #3426: Made find command output hover and clickable 9a7617f9 #3475: Add KickPlayerRaw channel 9a71358d #3439: Add GetPlayerServer bungee plugin message subchannel a96a2e80 #3437: Remove unused enum in ServerConnector and add color to exception message
2023-09-21 18:59:49 +02:00
@@ -258,9 +258,20 @@ public final class UserConnection implements ProxiedPlayer
2016-07-03 10:07:00 +02:00
2018-04-02 11:21:24 +02:00
public void connect(ServerInfo info, final Callback<Boolean> callback, final boolean retry, ServerConnectEvent.Reason reason)
2016-07-03 10:07:00 +02:00
{
+ // Waterfall start
+ connect(info, callback, retry, reason, bungee.getConfig().getServerConnectTimeout());
2016-07-03 10:07:00 +02:00
+ }
2018-04-02 11:21:24 +02:00
+ public void connect(ServerInfo info, final Callback<Boolean> callback, final boolean retry, int timeout) {
+ connect(info, callback, retry, ServerConnectEvent.Reason.PLUGIN, timeout);
+ }
+
+ public void connect(ServerInfo info, final Callback<Boolean> callback, final boolean retry, ServerConnectEvent.Reason reason, final int timeout)
2016-07-03 10:07:00 +02:00
+ {
+ // Waterfall end
Preconditions.checkNotNull( info, "info" );
2018-07-30 13:54:15 +02:00
ServerConnectRequest.Builder builder = ServerConnectRequest.builder().retry( retry ).reason( reason ).target( info );
+ builder.connectTimeout(timeout); // Waterfall
if ( callback != null )
{
// Convert the Callback<Boolean> to be compatible with Callback<Result> from ServerConnectRequest.
Updated Upstream (BungeeCord) 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: 5a1e342e Minecraft 1.20.2 support d9bbdc32 Add Java 21 compilation support cfe00fa4 #3490: Add ComponentBuilder#build() and ComponentSerializer#deserialize() d68ebd1e Minecraft 1.20.2-rc1 support a7cd79eb #3516: Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.5.0 to 3.6.0 9e83ee6f #3508: Use same compression threshold checks as Vanilla 7c81d917 #3513: Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.4.0 to 3.4.1 5b126b7f Fix javadoc plugin version in non-dist builds 9fe7d21f #3510: Bump actions/checkout from 3 to 4 94ea0271 #3505: Bump io.netty:netty-bom from 4.1.96.Final to 4.1.97.Final 3af672d2 #3504: Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.3.0 to 3.4.0 0dd7b984 Bump version to 1.20-R0.2-SNAPSHOT a793692a Release 1.20-R0.1 23fb8382 #3493: Bump io.netty:netty-bom from 4.1.95.Final to 4.1.96.Final 2d6d89d6 #3492: Bump io.netty:netty-bom from 4.1.94.Final to 4.1.95.Final 0199cb90 #3489: Add command string length limit when decoding ClientCommand 958cef50 #3488: Bump scriptus from 0.4.1 to 0.5.0 9f5ace90 #3418: Add tab completion for bungee command names in pre-1.13 versions 3a6e2631 #3479: Bump netty-bom from 4.1.93.Final to 4.1.94.Final c7adcf9f Disable maven enforcer for now da3616e6 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends b371fe67 #3478: Bump maven-shade-plugin from 3.4.1 to 3.5.0 6324c7d5 #3401: Only synchronize necessary parts of the BungeeServerInfo#sendData method 6263fe28 #3426: Made find command output hover and clickable 9a7617f9 #3475: Add KickPlayerRaw channel 9a71358d #3439: Add GetPlayerServer bungee plugin message subchannel a96a2e80 #3437: Remove unused enum in ServerConnector and add color to exception message
2023-09-21 18:59:49 +02:00
@@ -354,7 +365,7 @@ public final class UserConnection implements ProxiedPlayer
2018-07-30 13:54:15 +02:00
if ( request.isRetry() && def != null && ( getServer() == null || def != getServer().getInfo() ) )
2016-07-03 10:07:00 +02:00
{
sendMessage( bungee.getTranslation( "fallback_lobby" ) );
2018-04-02 11:21:24 +02:00
- connect( def, null, true, ServerConnectEvent.Reason.LOBBY_FALLBACK );
2018-07-30 13:54:15 +02:00
+ connect( def, null, true, ServerConnectEvent.Reason.LOBBY_FALLBACK, request.getConnectTimeout() ); // Waterfall
} else if ( dimensionChange )
2016-07-03 10:07:00 +02:00
{
disconnect( bungee.getTranslation( "fallback_kick", connectionFailMessage( future.cause() ) ) );
2016-07-03 10:07:00 +02:00
--
2023-09-21 12:33:23 +02:00
2.42.0
2016-07-03 10:07:00 +02:00