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.ConnectRetryIntervalSeconds = GameServerSettings.Default.ConnectReytryInterval; this.reader = new NodesReader(this.ApplicationRootPath, CommonSettings.Default.NodesFileName); this.S2SCacheMan = new S2SCustomTypeCacheMan(); }
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 "); }
private void NodesReader_OnNodeRemoved(object sender, NodesReader.NodeEventArgs e) { log.InfoFormat("Node {0} removed with address {1}", e.NodeId, e.Address); //this.RemoveNode(e.NodeId); }
private void NodesReader_OnNodeChanged(object sender, NodesReader.NodeEventArgs e) { log.InfoFormat("Node {0} changed: new address {1}", e.NodeId, e.Address); //this.ChangeNode(e.NodeId, e.Address); }
private void InitResolver() { string nodesFileName = CommonSettings.Default.NodesFileName; if (string.IsNullOrEmpty(nodesFileName)) { nodesFileName = "Nodes.txt"; } string path = new DirectoryInfo(Path.Combine(this.ApplicationPath, CommonSettings.Default.NodesFilePath)).FullName; this.reader = new NodesReader(path, nodesFileName); 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 instance {0} is {1}the master leader", this.reader.CurrentNodeId, this.MasterNodeId == this.reader.CurrentNodeId ? string.Empty : "NOT "); }