private void SafeCloseBfgMiner() { if (_rpcThread != null) { _rpcThread.Stop(); _rpcThread = null; } LOG.Info("Try to close BfgMiner."); if (_processMiner != null) { try { _processMiner.Kill(); _processMiner = null; } catch (Exception ex) { LOG.Error(ex); } } TryKillBfgMiner(); }
// start BfgMiner and request data through RPC private void RunMinerAndMonitorData() { string arguments = _appConfig.MinerInfo.GetCommandLine(); LOG.Info("arguments: " + arguments); if (!string.IsNullOrEmpty(arguments)) { _processMiner = _processManager.RunApplication2(Constants.BfgMinerFileName, _bfgMinerPath, arguments); Thread.Sleep(5000); _rpcThread = new RPCThread(Constants.BfgMinerServerAddress, Constants.BfgMinerServerPort, this.OnDataReceived); _rpcThread.Start(_appConfig.DebugData); } }