Пример #1
0
void AccessLog::onEvent(IEvent *event)
{
    if (m_file < 0) {
        return;
    }

    switch (event->type())
    {
    case IEvent::LoginType: {
            auto e = static_cast<LoginEvent*>(event);
            write("#%" PRId64 " login: %s, \"%s\", ua: \"%s\", count: %" PRIu64, e->miner()->id(), e->miner()->ip(), e->request.login(), e->request.agent(), Counters::miners());
        }
        break;

    case IEvent::CloseType: {
            auto e = static_cast<CloseEvent*>(event);
            if (e->miner()->mapperId() == -1) {
                break;
            }

            const double time = (double)(uv_now(uv_default_loop()) - e->miner()->timestamp()) / 1000;

            write("#%" PRId64 " close: %s, time: %03.1fs, rx/tx: %" PRIu64 "/%" PRIu64 ", count: %" PRIu64,
                  e->miner()->id(), e->miner()->ip(), time, e->miner()->rx(), e->miner()->tx(), Counters::miners());
        }
        break;

    default:
        break;
    }
}
Пример #2
0
int main(int argc, const char* argv[])
{
    Burst::MinerLogger::write("Burst cryptoport Miners");
    Burst::MinerLogger::write("-----------------------");
    Burst::MinerLogger::write("http://github.com/uraymeiviar/burst-miner");
    Burst::MinerLogger::write("author : uray meiviar [ [email protected] ]");
    Burst::MinerLogger::write("please donate to support developments :");
    Burst::MinerLogger::write(" [ Burst   ] BURST-8E8K-WQ2F-ZDZ5-FQWHX");
    Burst::MinerLogger::write(" [ Bitcoin ] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b");
    Burst::MinerLogger::write(" ");

#ifdef WIN32
	WSADATA   wsadata;
	if (WSAStartup(MAKEWORD(2, 2), &wsadata) != 0)
	{
		Burst::MinerLogger::write("failed to initalize networking system");
	}
#endif
    
    std::string configFile = "mining.conf";
    if(argc > 1)
    {
        if(argv[1][0] == '-')
        {
            Burst::MinerLogger::write("usage : burstminer <config-file>");
            Burst::MinerLogger::write("if no config-file specified, program will look for mining.conf file inside current directory");
        }
        configFile = std::string(argv[1]);
    }
    Burst::MinerLogger::write("using config file : "+configFile);
    
    Burst::MinerConfig config;
    if( config.readConfigFile(configFile) )
    {
        Burst::MinerLogger::write("Submission Max Delay : "+ std::to_string(config.submissionMaxDelay));
        Burst::MinerLogger::write("Submission Max Retry : "+ std::to_string(config.submissionMaxRetry));
		Burst::MinerLogger::write("Submission Max Deadline : " + std::to_string(config.submissionMaxDeadline));
        Burst::MinerLogger::write("Buffer Size : "+ std::to_string(config.maxBufferSizeMB)+"MB");
        Burst::MinerLogger::write("Pool Host : "+config.poolHost+" port "+ std::to_string(config.poolPort));
        
        Burst::Miner miner(config);
        miner.run();
    }
    else
    {
        Burst::MinerLogger::write("Aborting program due to invalid configuration");
    }
    
#ifdef WIN32
	WSACleanup();
#endif
    return 0;
}
bool SegmentIntersectJudgeTool::intersect(Lineseg u,Lineseg v) {
	return ((maxer(u.getStartPoint().getX(),u.getEndPoint().getX())>=miner(v.getStartPoint().getX(),v.getEndPoint().getX())) && (maxer(v.getStartPoint().getX(),v.getEndPoint().getX())>=miner(u.getStartPoint().getX(),u.getEndPoint().getX())) &&
		   (maxer(u.getStartPoint().getY(),u.getEndPoint().getY())>=miner(v.getStartPoint().getY(),v.getEndPoint().getY())) && (maxer(v.getStartPoint().getY(),v.getEndPoint().getY())>=miner(u.getStartPoint().getY(),u.getEndPoint().getY())) &&
		   (multiply(u.getStartPoint(),u.getEndPoint(),v.getStartPoint())*multiply(u.getStartPoint(),u.getEndPoint(),v.getEndPoint())<=0) && 
		   (multiply(v.getStartPoint(),v.getEndPoint(),u.getStartPoint())*multiply(v.getStartPoint(),v.getEndPoint(),u.getEndPoint())<=0));
}