当前位置: 首页>>代码示例>>C++>>正文


C++ CAddrDb::Add方法代码示例

本文整理汇总了C++中CAddrDb::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CAddrDb::Add方法的具体用法?C++ CAddrDb::Add怎么用?C++ CAddrDb::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAddrDb的用法示例。


在下文中一共展示了CAddrDb::Add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ThreadSeeder

extern "C" void* ThreadSeeder(void*) {
  if (!fTestNet){
    db.Add(CService("kjy2eqzk4zwi5zd3.onion", 17020), true);
  }
  do {
    for (int i=0; seeds[i] != ""; i++) {
      vector<CNetAddr> ips;
      LookupHost(seeds[i].c_str(), ips);
      for (vector<CNetAddr>::iterator it = ips.begin(); it != ips.end(); it++) {
        db.Add(CService(*it, GetDefaultPort()), true);
      }
    }
    Sleep(1800000);
  } while(1);
}
开发者ID:NewYorkCoin,项目名称:newyorkc-seeder,代码行数:15,代码来源:main.cpp

示例2: ThreadSeeder

extern "C" void* ThreadSeeder(void*) {
  if (!fTestNet){
    db.Add(CService("sibcoin.net", 1945), true);
  }
  do {
    for (int i=0; seeds[i] != ""; i++) {
      vector<CNetAddr> ips;
      LookupHost(seeds[i].c_str(), ips);
      for (vector<CNetAddr>::iterator it = ips.begin(); it != ips.end(); it++) {
        db.Add(CService(*it, GetDefaultPort()), true);
      }
    }
    Sleep(1800000);
  } while(1);
  return nullptr;
}
开发者ID:ivansib,项目名称:sibcoin-seeder,代码行数:16,代码来源:main.cpp

示例3: ThreadCrawler

extern "C" void* ThreadCrawler(void* data) {
  int *nThreads=(int*)data;
  do {
    std::vector<CServiceResult> ips;
    int wait = 5;
    db.GetMany(ips, 16, wait);
    int64 now = time(NULL);
    if (ips.empty()) {
      wait *= 1000;
      wait += rand() % (500 * *nThreads);
      Sleep(wait);
      continue;
    }
    vector<CAddress> addr;
    for (int i=0; i<ips.size(); i++) {
      CServiceResult &res = ips[i];
      res.nBanTime = 0;
      res.nClientV = 0;
      res.nHeight = 0;
      res.strClientV = "";
      bool getaddr = res.ourLastSuccess + 86400 < now;
      res.fGood = TestNode(res.service,res.nBanTime,res.nClientV,res.strClientV,res.nHeight,getaddr ? &addr : NULL);
    }
    db.ResultMany(ips);
    db.Add(addr);
  } while(1);
  return nullptr;
}
开发者ID:ivansib,项目名称:sibcoin-seeder,代码行数:28,代码来源:main.cpp

示例4: ThreadSeeder

extern "C" void* ThreadSeeder(void*) {
  if (!fTestNet){
    db.Add(CService("69.30.221.82", 19001, false), true);
    db.Add(CService("2607:fea8:3ca0:926::2", 15714, false), true);
    db.Add(CService("54ktu5wby3agev2d.onion", 15714), true);
    db.Add(CService("pqlf5ov3xzkqj3lt.onion", 15714), true);
  }
  do {
    for (int i=0; seeds[i] != ""; i++) {
      vector<CNetAddr> ips;
      LookupHost(seeds[i].c_str(), ips);
      for (vector<CNetAddr>::iterator it = ips.begin(); it != ips.end(); it++) {
        db.Add(CService(*it, GetDefaultPort()), true);
      }
    }
    Sleep(1800000);
  } while(1);
}
开发者ID:CoinBlack,项目名称:blackcoin-seeder,代码行数:18,代码来源:main.cpp

示例5: LookupHost

extern "C" void *ThreadSeeder(void *) {
    do {
        for (int i = 0; seeds[i] != ""; i++) {
            std::vector<CNetAddr> ips;
            LookupHost(seeds[i].c_str(), ips, MAX_HOSTS_PER_SEED, true);
            for (auto &ip : ips) {
                db.Add(CAddress(CService(ip, GetDefaultPort()), ServiceFlags()),
                       true);
            }
        }
        Sleep(1800000);
    } while (1);
    return nullptr;
}
开发者ID:a7853z,项目名称:bitcoin-abc,代码行数:14,代码来源:main.cpp

示例6: ThreadSeeder

extern "C" void* ThreadSeeder(void*) {
  if (!fTestNet){                        //TODO: Create Tor Seeds
  //  db.Add(CService("silknetwork.onion", 16662), true);
  }
  do {
    for (int i=0; seeds[i] != ""; i++) {
      vector<CNetAddr> ips;
      LookupHost(seeds[i].c_str(), ips);
      for (vector<CNetAddr>::iterator it = ips.begin(); it != ips.end(); it++) {
        db.Add(CService(*it, GetDefaultPort()), true);
      }
    }
    Sleep(1800000);
  } while(1);
}
开发者ID:SilkNetwork,项目名称:Silk-Seeder,代码行数:15,代码来源:main.cpp

示例7: ThreadSeeder

extern "C" void* ThreadSeeder(void*) {
  // When all seeders are down we need some reliable nodes to get initial addresses from.
  // Uncomment corresponding line and replace "some...ip" string with an IP of a good peer.
  if (fTestNet) {
    // db.Add(CService("sometestnnetnodeip", 19999), true);
  } else {
    // db.Add(CService("somemainnnetnodeip", 9999), true);
  }
  do {
    for (int i=0; seeds[i] != ""; i++) {
      vector<CNetAddr> ips;
      LookupHost(seeds[i].c_str(), ips);
      for (vector<CNetAddr>::iterator it = ips.begin(); it != ips.end(); it++) {
        db.Add(CService(*it, GetDefaultPort()), true);
      }
    }
    Sleep(1800000);
  } while(1);
  return nullptr;
}
开发者ID:nightlydash,项目名称:dash-seeder,代码行数:20,代码来源:main.cpp


注:本文中的CAddrDb::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。