Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- Index: java/net/sf/l2j/loginserver/data/xml/L2ProxyData.java
- ===================================================================
- --- java/net/sf/l2j/loginserver/data/xml/L2ProxyData.java (revision 10)
- +++ java/net/sf/l2j/loginserver/data/xml/L2ProxyData.java (nonexistent)
- @@ -1,77 +0,0 @@
- -package net.sf.l2j.loginserver.data.xml;
- -
- -import net.sf.l2j.commons.data.xml.IXmlReader;
- -import net.sf.l2j.commons.logging.CLogger;
- -import net.sf.l2j.loginserver.model.L2Proxy;
- -import org.w3c.dom.Document;
- -
- -import java.net.UnknownHostException;
- -import java.nio.file.Path;
- -import java.util.Collection;
- -import java.util.HashMap;
- -import java.util.Map;
- -
- -public class L2ProxyData implements IXmlReader
- -{
- - private static final CLogger LOGGER = new CLogger(L2ProxyData.class.getName());
- - private final Map<Integer, L2Proxy> _proxyServers = new HashMap<>();
- -
- - public L2Proxy getProxyById(int proxyId)
- - {
- - return _proxyServers.get(proxyId);
- - }
- -
- - public Collection<L2Proxy> getProxies()
- - {
- - return _proxyServers.values();
- - }
- -
- - @Override
- - public void load()
- - {
- - parseFile("./config/proxy.xml");
- - LOGGER.info("Loaded {} proxy servers.", _proxyServers.size());
- - }
- -
- - @Override
- - public void parseDocument(Document doc, Path path)
- - {
- - forEach(doc, "list", listNode ->
- - {
- - forEach(listNode, "gameserver", gameserverNode ->
- - {
- - final var gameserverSet = parseAttributes(gameserverNode);
- - var serverId = gameserverSet.getInteger("serverId");
- - var hidesGameserver = gameserverSet.getBool("hide");
- -
- - forEach(gameserverNode, "proxy", proxyNode -> {
- - final var proxySet = parseAttributes(proxyNode);
- - try
- - {
- - final var proxy = new L2Proxy(
- - serverId,
- - proxySet.getInteger("proxyServerId"),
- - proxySet.getString("proxyHost"),
- - proxySet.getInteger("proxyPort"),
- - hidesGameserver);
- - _proxyServers.put(proxySet.getInteger("proxyServerId"), proxy);
- - }
- - catch (UnknownHostException ex)
- - {
- - LOGGER.warn("Failed to process proxy due to badly formatted proxy host", ex);
- - }
- - });
- - });
- - });
- - }
- -
- - public static L2ProxyData getInstance()
- - {
- - return L2ProxyData.SingletonHolder.INSTANCE;
- - }
- -
- - private static class SingletonHolder
- - {
- - protected static final L2ProxyData INSTANCE = new L2ProxyData();
- - }
- -}
- \ No newline at end of file
- Index: java/net/sf/l2j/loginserver/model/L2ProxyInfo.java
- ===================================================================
- --- java/net/sf/l2j/loginserver/model/L2ProxyInfo.java (nonexistent)
- +++ java/net/sf/l2j/loginserver/model/L2ProxyInfo.java (working copy)
- @@ -0,0 +1,30 @@
- +package net.sf.l2j.loginserver.model;
- +
- +public class L2ProxyInfo
- +{
- + private final int _gameserverId;
- + private final boolean _hidesGameserver;
- + private final boolean _fallbackToGameserver;
- +
- + public L2ProxyInfo(int gameserverId, boolean hidesGameserver, boolean fallbackToGameserver)
- + {
- + _gameserverId = gameserverId;
- + _hidesGameserver = hidesGameserver;
- + _fallbackToGameserver = fallbackToGameserver;
- + }
- +
- + public boolean hidesGameserver()
- + {
- + return _hidesGameserver;
- + }
- +
- + public int getGameserverId()
- + {
- + return _gameserverId;
- + }
- +
- + public boolean isFallbackToGameserver()
- + {
- + return _fallbackToGameserver;
- + }
- +}
- \ No newline at end of file
- Index: config/proxy.xml
- ===================================================================
- --- config/proxy.xml (revision 10)
- +++ config/proxy.xml (working copy)
- @@ -1,6 +1,18 @@
- <?xml version='1.0' encoding='utf-8'?>
- <list>
- - <gameserver serverId="1" hide="true">
- - <proxy proxyServerId="2" proxyHost="127.0.0.1" proxyPort="7778"/>
- + <config />
- + <!--
- + serverId: The true id of the gameserver
- + hide: When enabled, the true gameserver will not appear in the server list
- + fallbackToGameserver: When the proxy server is down, when true, the real gameserver will appear
- + proxyServerId: The gameserver id that the proxy will use to be listed in the server list
- + proxyHost: The host of the proxy
- + proxyPort: The port of the proxy
- + apiPort: The port of the API for the proxy
- + apiKey: The api key for the proxy api
- + -->
- + <gameserver serverId="1" hide="true" fallbackToGameserver="false">
- + <proxy proxyServerId="2" proxyHost="127.0.0.1" proxyPort="7778" validateHealth="true" apiPort="6969" apiKey="changeit"/>
- + <proxy proxyServerId="3" proxyHost="127.0.0.1" proxyPort="7779" validateHealth="true" apiPort="6969" apiKey="changeit"/>
- </gameserver>
- </list>
- \ No newline at end of file
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 10)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -1424,6 +1424,11 @@
- NORMAL_CONNECTION_TIME = server.getProperty("NormalConnectionTime", 700);
- FAST_CONNECTION_TIME = server.getProperty("FastConnectionTime", 350);
- MAX_CONNECTION_PER_IP = server.getProperty("MaxConnectionPerIP", 50);
- +
- + SCHEDULED_THREAD_POOL_COUNT = server.getProperty("ScheduledThreadPoolCount", -1);
- + THREADS_PER_SCHEDULED_THREAD_POOL = server.getProperty("ThreadsPerScheduledThreadPool", 4);
- + INSTANT_THREAD_POOL_COUNT = server.getProperty("InstantThreadPoolCount", -1);
- + THREADS_PER_INSTANT_THREAD_POOL = server.getProperty("ThreadsPerInstantThreadPool", 2);
- }
- public static final void loadGameServer()
- Index: config/loginserver.properties
- ===================================================================
- --- config/loginserver.properties (revision 10)
- +++ config/loginserver.properties (working copy)
- @@ -50,4 +50,20 @@
- FastConnectionLimit = 15
- NormalConnectionTime = 700
- FastConnectionTime = 350
- -MaxConnectionPerIP = 50
- \ No newline at end of file
- +MaxConnectionPerIP = 50
- +
- +# =================================================================
- +# Threadpool
- +# =================================================================
- +
- +# Determines the amount of scheduled thread pools. If set to -1, the server will decide the amount depending on the available processors.
- +ScheduledThreadPoolCount = -1
- +
- +# Specifies how many threads will be in a single scheduled pool.
- +ThreadsPerScheduledThreadPool = 4
- +
- +# Determines the amount of instant thread pools. If set to -1, the server will decide the amount depending on the available processors.
- +InstantThreadPoolCount = -1
- +
- +# Specifies how many threads will be in a single instant pool.
- +ThreadsPerInstantThreadPool = 2
- \ No newline at end of file
- Index: java/net/sf/l2j/loginserver/data/manager/L2ProxyManager.java
- ===================================================================
- --- java/net/sf/l2j/loginserver/data/manager/L2ProxyManager.java (nonexistent)
- +++ java/net/sf/l2j/loginserver/data/manager/L2ProxyManager.java (working copy)
- @@ -0,0 +1,98 @@
- +package net.sf.l2j.loginserver.data.manager;
- +
- +import net.sf.l2j.commons.logging.CLogger;
- +import net.sf.l2j.commons.pool.ThreadPool;
- +import net.sf.l2j.loginserver.data.xml.L2ProxyDataLoader;
- +import net.sf.l2j.loginserver.model.L2Proxy;
- +import net.sf.l2j.loginserver.model.L2ProxyInfo;
- +import net.sf.l2j.util.PredicateHelpers;
- +
- +import java.io.IOException;
- +import java.net.URI;
- +import java.net.http.HttpClient;
- +import java.net.http.HttpRequest;
- +import java.net.http.HttpResponse;
- +import java.time.Duration;
- +import java.util.Collection;
- +import java.util.HashMap;
- +import java.util.Map;
- +import java.util.concurrent.ScheduledFuture;
- +import java.util.stream.Collectors;
- +
- +public enum L2ProxyManager
- +{
- + INSTANCE;
- +
- + private final CLogger _logger = new CLogger(L2ProxyDataLoader.class.getName());
- + private ScheduledFuture<?> _statusUpdateTask;
- + private Map<Integer, L2ProxyInfo> _proxyInfo = new HashMap<>();
- + private Map<Integer, L2Proxy> _proxyServers = new HashMap<>();
- + private final HttpClient _httpClient = HttpClient.newHttpClient();
- +
- + public synchronized void initialise(Map<Integer, L2ProxyInfo> proxyInfoList, Map<Integer, L2Proxy> proxies)
- + {
- + _proxyInfo = proxyInfoList;
- + _proxyServers = proxies;
- + _logger.info("Loaded {} proxy servers.", _proxyServers.size());
- +
- + if(_statusUpdateTask != null)
- + {
- + _statusUpdateTask.cancel(true);
- + }
- + _statusUpdateTask = ThreadPool.scheduleAtFixedRate(updateProxyHealthTask(), 0, 10000);
- + }
- +
- + public L2Proxy getProxyById(int proxyId)
- + {
- + return _proxyServers.get(proxyId);
- + }
- +
- + public Collection<L2Proxy> getProxies()
- + {
- + return _proxyServers.values();
- + }
- +
- + public L2ProxyInfo getProxyInfoByGameserverId(int gameserverId)
- + {
- + return _proxyInfo.get(gameserverId);
- + }
- +
- + private Runnable updateProxyHealthTask()
- + {
- + return () ->
- + {
- + var distinctProxyHosts = _proxyServers.values().stream()
- + .filter(L2Proxy::shouldValidateHealth)
- + .filter(PredicateHelpers.distinctByKeys(L2Proxy::getProxyAddress, L2Proxy::getProxyPort))
- + .map(x -> new Object() {
- + public final Integer proxyId = x.getProxyServerId();
- + public final String apiHost = x.getProxyAddress().getHostAddress();
- + public final Integer apiPort = x.getApiPort();
- + }).collect(Collectors.toList());
- +
- + for (var host : distinctProxyHosts)
- + {
- + var request = HttpRequest.newBuilder(
- + URI.create(String.format("http://%s:%s/_ping", host.apiHost, host.apiPort)))
- + .header("accept", "application/json")
- + .timeout(Duration.ofSeconds(5))
- + .build();
- +
- + try
- + {
- + var response = _httpClient.send(request, HttpResponse.BodyHandlers.ofString());
- + if (response.statusCode() == 200 && response.body().equals("pong"))
- + {
- + _proxyServers.get(host.proxyId).setHealthy(true);
- + continue;
- + }
- + _proxyServers.get(host.proxyId).setHealthy(false);
- + }
- + catch (IOException | InterruptedException e)
- + {
- + _proxyServers.get(host.proxyId).setHealthy(false);
- + }
- + }
- + };
- + }
- +}
- \ No newline at end of file
- Index: build.xml
- ===================================================================
- --- build.xml (revision 10)
- +++ build.xml (working copy)
- @@ -47,6 +47,7 @@
- <mkdir dir="${build.dist.game}/config/en" />
- <mkdir dir="${build.dist.game}/config/en/customs" />
- <mkdir dir="${build.dist.login}/config" />
- + <mkdir dir="${build.dist.login}/config/en" />
- <copy todir="${build.dist.game}/config">
- <fileset dir="config">
- <include name="*.properties" />
- @@ -62,6 +63,8 @@
- <copy todir="${build.dist.game}/config/en">
- <fileset dir="config/en">
- <include name="*.properties" />
- + <exclude name="banned_ips.properties" />
- + <exclude name="loginserver.properties" />
- </fileset>
- </copy>
- <copy todir="${build.dist.game}/config/en/customs">
- @@ -77,6 +80,14 @@
- <include name="proxy.xml" />
- </fileset>
- </copy>
- + <copy todir="${build.dist.login}/config/en">
- + <fileset dir="config/en">
- + <include name="banned_ips.properties" />
- + <include name="logging.properties" />
- + <include name="loginserver.properties" />
- + <include name="proxy.xml" />
- + </fileset>
- + </copy>
- <mkdir dir="${build.dist.game}/data" />
- </target>
- Index: config/en/proxy.xml
- ===================================================================
- --- config/en/proxy.xml (nonexistent)
- +++ config/en/proxy.xml (working copy)
- @@ -0,0 +1,18 @@
- +<?xml version='1.0' encoding='utf-8'?>
- +<list>
- + <config />
- + <!--
- + serverId: The true id of the gameserver
- + hide: When enabled, the true gameserver will not appear in the server list
- + fallbackToGameserver: When the proxy server is down, when true, the real gameserver will appear
- + proxyServerId: The gameserver id that the proxy will use to be listed in the server list
- + proxyHost: The host of the proxy
- + proxyPort: The port of the proxy
- + apiPort: The port of the API for the proxy
- + apiKey: The api key for the proxy api
- + -->
- + <gameserver serverId="1" hide="true" fallbackToGameserver="false">
- + <proxy proxyServerId="2" proxyHost="127.0.0.1" proxyPort="7778" validateHealth="true" apiPort="6969" apiKey="changeit"/>
- + <proxy proxyServerId="3" proxyHost="127.0.0.1" proxyPort="7779" validateHealth="true" apiPort="6969" apiKey="changeit"/>
- + </gameserver>
- +</list>
- \ No newline at end of file
- Index: java/net/sf/l2j/util/PredicateHelpers.java
- ===================================================================
- --- java/net/sf/l2j/util/PredicateHelpers.java (nonexistent)
- +++ java/net/sf/l2j/util/PredicateHelpers.java (working copy)
- @@ -0,0 +1,25 @@
- +package net.sf.l2j.util;
- +
- +import java.util.Arrays;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.concurrent.ConcurrentHashMap;
- +import java.util.function.Function;
- +import java.util.function.Predicate;
- +import java.util.stream.Collectors;
- +
- +public class PredicateHelpers
- +{
- + @SafeVarargs
- + public static <T> Predicate<T> distinctByKeys(Function<? super T, ?>... keyExtractors)
- + {
- + final Map<List<?>, Boolean> seen = new ConcurrentHashMap<>();
- + return t ->
- + {
- + final List<?> keys = Arrays.stream(keyExtractors)
- + .map(ke -> ke.apply(t))
- + .collect(Collectors.toList());
- + return seen.putIfAbsent(keys, Boolean.TRUE) == null;
- + };
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/loginserver/data/xml/L2ProxyDataLoader.java
- ===================================================================
- --- java/net/sf/l2j/loginserver/data/xml/L2ProxyDataLoader.java (nonexistent)
- +++ java/net/sf/l2j/loginserver/data/xml/L2ProxyDataLoader.java (working copy)
- @@ -0,0 +1,74 @@
- +package net.sf.l2j.loginserver.data.xml;
- +
- +import net.sf.l2j.commons.data.xml.IXmlReader;
- +import net.sf.l2j.commons.logging.CLogger;
- +import net.sf.l2j.loginserver.data.manager.L2ProxyManager;
- +import net.sf.l2j.loginserver.model.L2Proxy;
- +import net.sf.l2j.loginserver.model.L2ProxyInfo;
- +import org.w3c.dom.Document;
- +
- +import java.net.UnknownHostException;
- +import java.nio.file.Path;
- +import java.util.HashMap;
- +
- +public class L2ProxyDataLoader implements IXmlReader
- +{
- + private static final CLogger LOGGER = new CLogger(L2ProxyDataLoader.class.getName());
- +
- + @Override
- + public void load()
- + {
- + parseFile("./config/proxy.xml");
- + }
- +
- + @Override
- + public void parseDocument(Document doc, Path path)
- + {
- + var proxyInfoList = new HashMap<Integer, L2ProxyInfo>();
- + var proxies = new HashMap<Integer, L2Proxy>();
- + forEach(doc, "list", listNode ->
- + {
- + forEach(listNode, "gameserver", gameserverNode ->
- + {
- + final var gameserverSet = parseAttributes(gameserverNode);
- + var serverId = gameserverSet.getInteger("serverId");
- + var hidesGameserver = gameserverSet.getBool("hide");
- + var fallbackToGameserver = gameserverSet.getBool("fallbackToGameserver");
- + var proxyInfo = new L2ProxyInfo(serverId, hidesGameserver, fallbackToGameserver);
- + proxyInfoList.put(serverId, proxyInfo);
- +
- + forEach(gameserverNode, "proxy", proxyNode ->
- + {
- + final var proxySet = parseAttributes(proxyNode);
- + try
- + {
- + final var proxy = new L2Proxy(
- + serverId,
- + proxySet.getInteger("proxyServerId"),
- + proxySet.getString("proxyHost"),
- + proxySet.getInteger("proxyPort"),
- + proxySet.getString("apiKey"),
- + proxySet.getInteger("apiPort"),
- + proxySet.getBool("validateHealth"));
- + proxies.put(proxySet.getInteger("proxyServerId"), proxy);
- + }
- + catch (UnknownHostException ex)
- + {
- + LOGGER.warn("Failed to process proxy due to badly formatted proxy host", ex);
- + }
- + });
- + });
- + });
- + L2ProxyManager.INSTANCE.initialise(proxyInfoList, proxies);
- + }
- +
- + public static L2ProxyDataLoader getInstance()
- + {
- + return SingletonHolder.INSTANCE;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final L2ProxyDataLoader INSTANCE = new L2ProxyDataLoader();
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/loginserver/LoginServer.java
- ===================================================================
- --- java/net/sf/l2j/loginserver/LoginServer.java (revision 10)
- +++ java/net/sf/l2j/loginserver/LoginServer.java (working copy)
- @@ -13,12 +13,13 @@
- import net.sf.l2j.commons.mmocore.SelectorConfig;
- import net.sf.l2j.commons.mmocore.SelectorThread;
- import net.sf.l2j.commons.pool.ConnectionPool;
- +import net.sf.l2j.commons.pool.ThreadPool;
- import net.sf.l2j.Config;
- import net.sf.l2j.loginserver.data.manager.GameServerManager;
- import net.sf.l2j.loginserver.data.manager.IpBanManager;
- import net.sf.l2j.loginserver.data.sql.AccountTable;
- -import net.sf.l2j.loginserver.data.xml.L2ProxyData;
- +import net.sf.l2j.loginserver.data.xml.L2ProxyDataLoader;
- import net.sf.l2j.loginserver.network.LoginClient;
- import net.sf.l2j.loginserver.network.LoginPacketHandler;
- @@ -56,6 +57,7 @@
- StringUtil.printSection("Poolers");
- ConnectionPool.init();
- + ThreadPool.init();
- AccountTable.getInstance();
- @@ -66,7 +68,7 @@
- GameServerManager.getInstance();
- StringUtil.printSection("L2Proxy");
- - L2ProxyData.getInstance().load();
- + L2ProxyDataLoader.getInstance().load();
- StringUtil.printSection("Ban List");
- IpBanManager.getInstance();
- Index: config/en/loginserver.properties
- ===================================================================
- --- config/en/loginserver.properties (revision 10)
- +++ config/en/loginserver.properties (working copy)
- @@ -53,4 +53,20 @@
- FastConnectionLimit = 15
- NormalConnectionTime = 700
- FastConnectionTime = 350
- -MaxConnectionPerIP = 50
- \ No newline at end of file
- +MaxConnectionPerIP = 50
- +
- +# =================================================================
- +# Threadpool
- +# =================================================================
- +
- +# Determines the amount of scheduled thread pools. If set to -1, the server will decide the amount depending on the available processors.
- +ScheduledThreadPoolCount = -1
- +
- +# Specifies how many threads will be in a single scheduled pool.
- +ThreadsPerScheduledThreadPool = 4
- +
- +# Determines the amount of instant thread pools. If set to -1, the server will decide the amount depending on the available processors.
- +InstantThreadPoolCount = -1
- +
- +# Specifies how many threads will be in a single instant pool.
- +ThreadsPerInstantThreadPool = 2
- \ No newline at end of file
- Index: java/net/sf/l2j/loginserver/model/Account.java
- ===================================================================
- --- java/net/sf/l2j/loginserver/model/Account.java (revision 10)
- +++ java/net/sf/l2j/loginserver/model/Account.java (working copy)
- @@ -3,8 +3,8 @@
- import net.sf.l2j.commons.network.ServerType;
- import net.sf.l2j.loginserver.data.manager.GameServerManager;
- +import net.sf.l2j.loginserver.data.manager.L2ProxyManager;
- import net.sf.l2j.loginserver.data.sql.AccountTable;
- -import net.sf.l2j.loginserver.data.xml.L2ProxyData;
- public final class Account
- {
- @@ -44,7 +44,7 @@
- public final boolean isLoginPossible(int serverId)
- {
- GameServerInfo gsi = GameServerManager.getInstance().getRegisteredGameServers().get(serverId);
- - L2Proxy proxy = L2ProxyData.getInstance().getProxyById(serverId);
- + L2Proxy proxy = L2ProxyManager.INSTANCE.getProxyById(serverId);
- if(gsi == null && proxy != null)
- gsi = GameServerManager.getInstance().getRegisteredGameServers().get(proxy.getGameserverId());
- Index: java/net/sf/l2j/loginserver/network/serverpackets/ServerList.java
- ===================================================================
- --- java/net/sf/l2j/loginserver/network/serverpackets/ServerList.java (revision 10)
- +++ java/net/sf/l2j/loginserver/network/serverpackets/ServerList.java (working copy)
- @@ -10,7 +10,7 @@
- import net.sf.l2j.commons.network.ServerType;
- import net.sf.l2j.loginserver.data.manager.GameServerManager;
- -import net.sf.l2j.loginserver.data.xml.L2ProxyData;
- +import net.sf.l2j.loginserver.data.manager.L2ProxyManager;
- import net.sf.l2j.loginserver.model.Account;
- import net.sf.l2j.loginserver.model.GameServerInfo;
- import net.sf.l2j.loginserver.model.L2Proxy;
- @@ -33,21 +33,35 @@
- final ServerType type = (account.getAccessLevel() < 0 || (gsi.getType() == ServerType.GM_ONLY && account.getAccessLevel() <= 0)) ? ServerType.DOWN : gsi.getType();
- final String hostName = gsi.getHostName();
- - var proxiesForGameserver = L2ProxyData.getInstance().getProxies().stream()
- + var proxyInfo = L2ProxyManager.INSTANCE.getProxyInfoByGameserverId(gsi.getId());
- +
- + if(proxyInfo == null)
- + {
- + _servers.add(new ServerData(type, hostName, gsi));
- + continue;
- + }
- +
- + var proxiesForGameserver = L2ProxyManager.INSTANCE.getProxies().stream()
- .filter(x -> x.getGameserverId() == gsi.getId()).collect(Collectors.toList());
- -
- - if(proxiesForGameserver.stream().noneMatch(L2Proxy::hidesGameserver))
- +
- + if(!proxyInfo.hidesGameserver())
- {
- _servers.add(new ServerData(type, hostName, gsi));
- }
- -
- +
- + if(proxyInfo.isFallbackToGameserver() && proxiesForGameserver.stream().noneMatch(L2Proxy::isHealthy))
- + {
- + _servers.add(new ServerData(type, hostName, gsi));
- + }
- +
- proxiesForGameserver.forEach(l2Proxy ->
- {
- - _servers.add(new ServerData(type, l2Proxy.getProxyServerId(), l2Proxy.getProxyAddress().getHostAddress(), l2Proxy.getProxyPort(), gsi));
- + var newType = l2Proxy.isHealthy() ? ServerType.GOOD : ServerType.DOWN;
- + _servers.add(new ServerData(newType, l2Proxy.getProxyServerId(), l2Proxy.getProxyAddress().getHostAddress(), l2Proxy.getProxyPort(), gsi));
- });
- -
- - _servers.sort(SERVER_DATA_COMPARATOR);
- }
- +
- + _servers.sort(SERVER_DATA_COMPARATOR);
- }
- @Override
- Index: java/net/sf/l2j/loginserver/model/L2Proxy.java
- ===================================================================
- --- java/net/sf/l2j/loginserver/model/L2Proxy.java (revision 10)
- +++ java/net/sf/l2j/loginserver/model/L2Proxy.java (working copy)
- @@ -9,15 +9,21 @@
- private final int _proxyServerId;
- private final InetAddress _proxyAddress;
- private final int _proxyPort;
- - private final boolean _hidesGameserver;
- + private final String _apiKey;
- + private final int _apiPort;
- + private final boolean _validateHealth;
- + private boolean _isHealthy = true;
- + private int _maxConnections = -1;
- - public L2Proxy(int gameserverId, int proxyServerId, String proxyHost, int proxyPort, boolean hidesGameserver) throws UnknownHostException
- + public L2Proxy(int gameserverId, int proxyServerId, String proxyHost, int proxyPort, String apiKey, int apiPort, boolean validateHealth) throws UnknownHostException
- {
- _gameserverId = gameserverId;
- _proxyServerId = proxyServerId;
- _proxyAddress = InetAddress.getByName(proxyHost);
- _proxyPort = proxyPort;
- - _hidesGameserver = hidesGameserver;
- + _apiKey = apiKey;
- + _apiPort = apiPort;
- + _validateHealth = validateHealth;
- }
- public int getGameserverId()
- @@ -40,8 +46,38 @@
- return _proxyPort;
- }
- - public boolean hidesGameserver()
- + public boolean isHealthy()
- {
- - return _hidesGameserver;
- + return _isHealthy;
- }
- +
- + public void setHealthy(boolean healthy)
- + {
- + _isHealthy = healthy;
- + }
- +
- + public int getMaxConnections()
- + {
- + return _maxConnections;
- + }
- +
- + public void setMaxConnections(int maxConnections)
- + {
- + _maxConnections = maxConnections;
- + }
- +
- + public String getApiKey()
- + {
- + return _apiKey;
- + }
- +
- + public int getApiPort()
- + {
- + return _apiPort;
- + }
- +
- + public boolean shouldValidateHealth()
- + {
- + return _validateHealth;
- + }
- }
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement