本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}