private static void Run() { try { Windows.ConsoleHandler.Register(Exit); HttpServer.Start($"http://{NTKeyword.Localhost}:{NTKeyword.NTMinerDaemonPort.ToString()}"); DaemonWsClient = new DaemonWsClient(); AddEventPath <Per2MinuteEvent>("每2分钟通过Ws通道上报一次算力", LogEnum.DevConsole, action: message => { if (!DaemonWsClient.IsOpen) { return; } RpcRoot.Client.MinerClientService.WsGetSpeedAsync((data, ex) => { if (!DaemonWsClient.IsOpen) { return; } DaemonWsClient.SendAsync(new WsMessage(Guid.NewGuid(), WsMessage.Speed) { Data = data }); }); }, typeof(VirtualRoot)); _waitHandle.WaitOne(); Exit(); } catch (Exception e) { Logger.ErrorDebugLine(e); } finally { Exit(); } }
private static void Run() { try { Windows.ConsoleHandler.Register(Exit); HttpServer.Start($"http://{NTKeyword.Localhost}:{NTKeyword.NTMinerDaemonPort.ToString()}"); DaemonWsClient = new DaemonWsClient(); _waitHandle.WaitOne(); Exit(); } catch (Exception e) { Logger.ErrorDebugLine(e); } finally { Exit(); } }