static void Main(string[] args) { // command line parser commandLineParser = new CommandLineParser(args); // load Configuration Configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile(APPSETTINGS, optional: true, reloadOnChange: true) .Build(); int port = commandLineParser.Value("port", Configuration.GetValue <int>("NodeService:Port")); // logger Logger = new BLog.Builder() .WithConsole(true) // .WithLogger(new RotateFileLogger($"logs/ElasticNodeServiceApp-{port}.log")) .Global(true) .WithFilter(LogFilter.All) .Build(); Logger.info($"Hello, Bryllite! args={commandLineParser.ToString()}"); // peer list provider IPeerList peers = new PeerList(Logger); using (var cts = new CancellationTokenSource()) { NodeService = new NodeService(Configuration.GetSection("NodeService"), Logger, peers); NodeService.Start(port, 16, cts); Console.CancelKeyPress += (sender, e) => { e.Cancel = true; cts.Cancel(); }; // console command if (commandLineParser.Value("console", false)) { NodeService.StartConsole(); } while (!cts.Token.IsCancellationRequested) { Thread.Sleep(10); NodeService.Update(); } NodeService.Stop(); } Logger.info($"Bye, Bryllite!"); }
public void OnTcpStart(string host, int port) { Logger.info($"PeerListService started {host}:{port} {EndPoint.ToString()}"); }
private void OnTcpServerStart(string host, int port) { Logger.info($"ElasticNode.OnTcpServerStart({host}, {port})"); }
public void OnTcpConnect(ITcpClient client) { Logger.info($"PeerListService connected"); Register(client.Session); }