#2752: Configurable connect and ping timeouts
This commit is contained in:
@@ -78,6 +78,22 @@ public interface ProxyConfig
|
||||
*/
|
||||
Collection<String> getDisabledCommands();
|
||||
|
||||
/**
|
||||
* Time in milliseconds before timing out a clients request to connect to a
|
||||
* server.
|
||||
*
|
||||
* @return connect timeout
|
||||
*/
|
||||
int getServerConnectTimeout();
|
||||
|
||||
/**
|
||||
* Time in milliseconds before timing out a ping request from the proxy to a
|
||||
* server when attempting to request server list info.
|
||||
*
|
||||
* @return ping timeout
|
||||
*/
|
||||
int getRemotePingTimeout();
|
||||
|
||||
/**
|
||||
* The connection throttle delay.
|
||||
*
|
||||
@@ -87,7 +103,7 @@ public interface ProxyConfig
|
||||
int getThrottle();
|
||||
|
||||
/**
|
||||
* Whether the proxy will parse IPs with spigot or not
|
||||
* Whether the proxy will parse IPs with spigot or not.
|
||||
*
|
||||
* @return ip forward
|
||||
*/
|
||||
|
@@ -73,6 +73,6 @@ public class ServerConnectRequest
|
||||
public static class Builder
|
||||
{
|
||||
|
||||
private int connectTimeout = 5000; // TODO: Configurable
|
||||
private int connectTimeout = ProxyServer.getInstance().getConfig().getServerConnectTimeout();
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@ import java.util.Collection;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.ServerConnectEvent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ServerConnectRequestTest
|
||||
@@ -79,13 +78,6 @@ public class ServerConnectRequestTest
|
||||
}
|
||||
};
|
||||
|
||||
@Test
|
||||
public void testDefaultConnectTimeout()
|
||||
{
|
||||
ServerConnectRequest request = ServerConnectRequest.builder().target( DUMMY_INFO ).reason( ServerConnectEvent.Reason.JOIN_PROXY ).build();
|
||||
Assert.assertEquals( 5000, request.getConnectTimeout() );
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testNullTarget()
|
||||
{
|
||||
|
Reference in New Issue
Block a user