static void html_srvlist( void ) { TABLE_START( opf ); os_fprintf( opf, "<tr><th colspan = 2>Server name</th></tr>" ); GetServerStats( serverlisthandler, NULL ); TABLE_END( opf ); }
void RPCMinerClient::Run(const std::string &url, const std::string &user, const std::string &password, const int threadcount) { m_running=true; m_done=false; m_url=url; m_user=user; m_password=password; m_threadcount=threadcount; int64 lastrequestedwork=GetTimeMillis()-5000; int64 laststats=GetTimeMillis()-25000; m_lasttarget=0; m_lasthashdisplay=GetTimeMillis(); int64 timenowmillis; static unsigned int counter=0u; std::cout << "Client will start " << m_threadcount << " miner threads" << std::endl; std::cout << "Work will be refreshed every " << m_workrefreshms << " ms" << std::endl; while(Done()==false && HasError() == false) { if(m_minerthreads.RunningThreadCount()<m_threadcount) { int nextDeviceIndex = m_minerthreads.LastDeviceIndex() + 1; m_minerthreads.Start(new threadtype(nextDeviceIndex)); } /* if(lastrequestedwork<=GetTimeMillis()-m_workrefreshms) { SendWorkRequest(); lastrequestedwork=GetTimeMillis(); } */ if(m_serverstatsurl!="" && laststats<=GetTimeMillis()-60000) { json_spirit::Object statsobj; if(GetServerStats(statsobj)) { PrintServerStats(statsobj); } laststats=GetTimeMillis(); } if(m_minerthreads.HaveFoundHash()) { std::cout << GetTimeStr(time(0)) << " Found Hash!" << std::endl; foundhash fhash; m_minerthreads.GetFoundHash(fhash); ++counter; std::cout<<"Hashs found: "<<counter<<std::endl; SendFoundHash(fhash.m_blockid,fhash.m_nonce); SendWorkRequest(); lastrequestedwork=GetTimeMillis(); } CleanupOldBlocks(); if(lastrequestedwork<=GetTimeMillis()-m_workrefreshms) { SendWorkRequest(); lastrequestedwork=GetTimeMillis(); } timenowmillis=GetTimeMillis(); if(m_hashraterefresh>0 && (m_lasthashdisplay+m_hashraterefresh)<=timenowmillis) { int64 hr=GetHashRate(true); if(m_blocklookup.size()>0) { std::cout << hr << " khash/s" << std::endl; } else { if(m_startuptime+30000<timenowmillis) { std::cout << "No blocks are being hashed right now. This can happen if the application is" << std::endl; std::cout << "still starting up, you supplied incorrect parameters, or there is a" << std::endl; std::cout << "communications error connecting to the RPC server." << std::endl; m_minerthreads.ClearWork(); } } } Sleep(10); } m_running=false; }
static void html_srvlistdet( void ) { TABLE_START( opf ); GetServerStats( serverlistdetailhandler, NULL ); TABLE_END( opf ); }