public GameApplication() { IPAddress masterAddress; if (!IPAddress.TryParse(GameServerSettings.Default.MasterIPAddress, out masterAddress)) { var addresses = Dns.GetHostEntry(GameServerSettings.Default.MasterIPAddress); if (addresses.AddressList == null || addresses.AddressList.Length == 0) { throw new ConfigurationException( "MasterIPAddress setting is neither an IP nor an DNS entry: " + GameServerSettings.Default.MasterIPAddress); } masterAddress = addresses.AddressList[0]; } int masterPort = GameServerSettings.Default.OutgoingMasterServerPeerPort; this.MasterEndPoint = new IPEndPoint(masterAddress, masterPort); this.GamingTcpPort = GameServerSettings.Default.GamingTcpPort; this.GamingUdpPort = GameServerSettings.Default.GamingUdpPort; this.GamingWebSocketPort = GameServerSettings.Default.GamingWebSocketPort; this.ConnectRetryIntervalSeconds = GameServerSettings.Default.ConnectReytryInterval; this.reader = new NodesReader(this.ApplicationRootPath, CommonSettings.Default.NodesFileName); }
private void InitResolver() { string nodesFileName = CommonSettings.Default.NodesFileName; if (string.IsNullOrEmpty(nodesFileName)) { nodesFileName = "Nodes.txt"; } this.reader = new NodesReader(this.ApplicationRootPath, nodesFileName); // TODO: remove Proxy code completly //if (this.IsResolver && MasterServerSettings.Default.EnableProxyConnections) //{ // // setup for proxy connections // this.reader.NodeAdded += this.NodesReader_OnNodeAdded; // this.reader.NodeChanged += this.NodesReader_OnNodeChanged; // this.reader.NodeRemoved += this.NodesReader_OnNodeRemoved; // log.Info("Proxy connections enabled"); //} this.reader.Start(); // use local host id if nodes.txt does not exist or if line ending with 'Y' does not exist, otherwise use fixed node #1 this.MasterNodeId = (byte)(this.LocalNodeId == 0 ? 0 : 1); log.InfoFormat( "Current Node (nodeId={0}) is {1}the active master (leader)", this.reader.CurrentNodeId, this.MasterNodeId == this.reader.CurrentNodeId ? string.Empty : "NOT "); }
public GameApplication() { UpdateMasterEndPoint(); this.GamingTcpPort = GameServerSettings.Default.GamingTcpPort; this.GamingUdpPort = GameServerSettings.Default.GamingUdpPort; this.GamingWebSocketPort = GameServerSettings.Default.GamingWebSocketPort; this.ConnectRetryIntervalSeconds = GameServerSettings.Default.ConnectReytryInterval; this.reader = new NodesReader(this.ApplicationRootPath, CommonSettings.Default.NodesFileName); }
public GameApplication() { AppDomain.CurrentDomain.AssemblyResolve += PluginManager.OnAssemblyResolve; this.UpdateMasterEndPoint(); this.ServerId = Guid.NewGuid(); this.GamingTcpPort = GameServerSettings.Default.GamingTcpPort; this.GamingUdpPort = GameServerSettings.Default.GamingUdpPort; this.GamingWebSocketPort = GameServerSettings.Default.GamingWebSocketPort; this.GamingSecureWebSocketPort = GameServerSettings.Default.GamingSecureWebSocketPort; this.GamingHttpPort = GameServerSettings.Default.GamingHttpPort; this.GamingHttpsPort = GameServerSettings.Default.GamingHttpsPort; this.GamingHttpPath = string.IsNullOrEmpty(GameServerSettings.Default.GamingHttpPath) ? string.Empty : "/" + GameServerSettings.Default.GamingHttpPath; this.GamingWebRTCPort = GameServerSettings.Default.GamingWebRTCPort; this.ConnectRetryIntervalSeconds = GameServerSettings.Default.ConnectReytryInterval; this.reader = new NodesReader(this.ApplicationRootPath, CommonSettings.Default.NodesFileName); var env = new Dictionary <string, object> { { "AppId", this.HwId }, { "AppVersion", "" }, { "Region", "" }, { "Cloud", "" }, }; var options = new HttpRequestQueueOptions( CommonSettings.Default.WebRpcHttpQueueMaxErrors, CommonSettings.Default.WebRpcHttpQueueMaxTimeouts, CommonSettings.Default.WebRpcHttpQueueRequestTimeout, CommonSettings.Default.WebRpcHttpQueueQueueTimeout, CommonSettings.Default.WebRpcHttpQueueMaxBackoffTime, CommonSettings.Default.WebRpcHttpQueueReconnectInterval, CommonSettings.Default.WebRpcHttpQueueMaxQueuedRequests, CommonSettings.Default.WebRpcHttpQueueMaxConcurrentRequests); var settings = WebRpcSettings.Default; var webRpcEnabled = (settings != null && settings.Enabled); var baseUrlString = webRpcEnabled ? settings.BaseUrl.Value : string.Empty; this.webRpcManager = new WebRpcManager(webRpcEnabled, baseUrlString, env, options); }
public GameApplication() { AppDomain.CurrentDomain.AssemblyResolve += PluginManager.OnAssemblyResolve; this.UpdateMasterEndPoint(); this.ServerId = Guid.NewGuid(); this.GamingTcpPort = GameServerSettings.Default.GamingTcpPort; this.GamingUdpPort = GameServerSettings.Default.GamingUdpPort; this.GamingWebSocketPort = GameServerSettings.Default.GamingWebSocketPort; this.GamingSecureWebSocketPort = GameServerSettings.Default.GamingSecureWebSocketPort; this.GamingHttpPort = GameServerSettings.Default.GamingHttpPort; this.GamingHttpsPort = GameServerSettings.Default.GamingHttpsPort; this.GamingHttpPath = string.IsNullOrEmpty(GameServerSettings.Default.GamingHttpPath) ? string.Empty : "/" + GameServerSettings.Default.GamingHttpPath; this.ConnectRetryIntervalSeconds = GameServerSettings.Default.ConnectReytryInterval; this.reader = new NodesReader(this.ApplicationRootPath, CommonSettings.Default.NodesFileName); this.S2SCacheMan = new S2SCustomTypeCacheMan(); }
static void Main(string[] args) { string answer = String.Empty; LoaderServiceClient loaderService = new LoaderServiceClient(); while (answer != "Y" && answer != "N" && answer != "X") { Console.WriteLine("Do you want to clean db first? Please type Y/N or X for exit"); answer = Console.ReadLine(); } switch (answer) { case "Y": loaderService.ClearDatabase(); break; case "N": break; case "X": return; default: throw new ArgumentException(); } var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var files = Directory.GetFiles(path, "*.xml"); NodesReader nodeasReader = new NodesReader(); var graph = nodeasReader.Read(files); foreach (var node in graph.NodesList.Values) { loaderService.SaveNode(node.UniqueId, node.Label); } foreach (var adjacency in graph.Adjacencies) { loaderService.SaveAdjacency(adjacency.Key, adjacency.Value); } }