Page MenuHomePhabricator

D4251.id13545.diff
No OneTemporary

D4251.id13545.diff

diff --git a/src/seeder/main.cpp b/src/seeder/main.cpp
--- a/src/seeder/main.cpp
+++ b/src/seeder/main.cpp
@@ -24,12 +24,12 @@
const bool fUseTestNet_default = false;
const bool fWipeBan_default = false;
const bool fWipeIgnore_default = false;
-const char *mbox_default = nullptr;
-const char *ns_default = nullptr;
-const char *host_default = nullptr;
-const char *tor_default = nullptr;
-const char *ipv4_proxy_default = nullptr;
-const char *ipv6_proxy_default = nullptr;
+const std::string mbox_default = "";
+const std::string ns_default = "";
+const std::string host_default = "";
+const std::string tor_default = "";
+const std::string ipv4_proxy_default = "";
+const std::string ipv6_proxy_default = "";
class CDnsSeedOpts {
public:
@@ -39,12 +39,12 @@
int fUseTestNet;
int fWipeBan;
int fWipeIgnore;
- const char *mbox;
- const char *ns;
- const char *host;
- const char *tor;
- const char *ipv4_proxy;
- const char *ipv6_proxy;
+ std::string mbox;
+ std::string ns;
+ std::string host;
+ std::string tor;
+ std::string ipv4_proxy;
+ std::string ipv6_proxy;
std::set<uint64_t> filter_whitelist;
CDnsSeedOpts()
@@ -104,17 +104,17 @@
if (c == -1) break;
switch (c) {
case 'h': {
- host = optarg;
+ host = std::string(optarg);
break;
}
case 'm': {
- mbox = optarg;
+ mbox = std::string(optarg);
break;
}
case 'n': {
- ns = optarg;
+ ns = std::string(optarg);
break;
}
@@ -137,17 +137,17 @@
}
case 'o': {
- tor = optarg;
+ tor = std::string(optarg);
break;
}
case 'i': {
- ipv4_proxy = optarg;
+ ipv4_proxy = std::string(optarg);
break;
}
case 'k': {
- ipv6_proxy = optarg;
+ ipv6_proxy = std::string(optarg);
break;
}
@@ -177,7 +177,7 @@
filter_whitelist.insert(NODE_NETWORK | NODE_XTHIN);
filter_whitelist.insert(NODE_NETWORK | NODE_BLOOM | NODE_XTHIN);
}
- if (host != nullptr && ns == nullptr) showHelp = true;
+ if (!host.empty() && ns.empty()) showHelp = true;
if (showHelp) fprintf(stderr, help, argv[0]);
}
};
@@ -286,9 +286,9 @@
}
CDnsThread(CDnsSeedOpts *opts, int idIn) : id(idIn) {
- dns_opt.host = opts->host;
- dns_opt.ns = opts->ns;
- dns_opt.mbox = opts->mbox;
+ dns_opt.host = opts->host.c_str();
+ dns_opt.ns = opts->ns.c_str();
+ dns_opt.mbox = opts->mbox.c_str();
dns_opt.datattl = 3600;
dns_opt.nsttl = 40000;
dns_opt.cb = GetIPList;
@@ -504,24 +504,24 @@
fprintf(stdout, "0x%lx", (unsigned long)*it);
}
fprintf(stdout, "\n");
- if (opts.tor) {
- CService service(LookupNumeric(opts.tor, 9050));
+ if (!opts.tor.empty()) {
+ CService service(LookupNumeric(opts.tor.c_str(), 9050));
if (service.IsValid()) {
fprintf(stdout, "Using Tor proxy at %s\n",
service.ToStringIPPort().c_str());
SetProxy(NET_ONION, proxyType(service));
}
}
- if (opts.ipv4_proxy) {
- CService service(LookupNumeric(opts.ipv4_proxy, 9050));
+ if (!opts.ipv4_proxy.empty()) {
+ CService service(LookupNumeric(opts.ipv4_proxy.c_str(), 9050));
if (service.IsValid()) {
fprintf(stdout, "Using IPv4 proxy at %s\n",
service.ToStringIPPort().c_str());
SetProxy(NET_IPV4, proxyType(service));
}
}
- if (opts.ipv6_proxy) {
- CService service(LookupNumeric(opts.ipv6_proxy, 9050));
+ if (!opts.ipv6_proxy.empty()) {
+ CService service(LookupNumeric(opts.ipv6_proxy.c_str(), 9050));
if (service.IsValid()) {
fprintf(stdout, "Using IPv6 proxy at %s\n",
service.ToStringIPPort().c_str());
@@ -538,15 +538,15 @@
seeds = testnet_seeds;
fTestNet = true;
}
- if (!opts.ns) {
+ if (opts.ns.empty()) {
fprintf(stdout, "No nameserver set. Not starting DNS server.\n");
fDNS = false;
}
- if (fDNS && !opts.host) {
+ if (fDNS && opts.host.empty()) {
fprintf(stderr, "No hostname set. Please use -h.\n");
exit(1);
}
- if (fDNS && !opts.mbox) {
+ if (fDNS && opts.mbox.empty()) {
fprintf(stderr, "No e-mail address set. Please use -m.\n");
exit(1);
}
@@ -568,7 +568,8 @@
pthread_t threadDns, threadSeed, threadDump, threadStats;
if (fDNS) {
fprintf(stdout, "Starting %i DNS threads for %s on %s (port %i)...",
- opts.nDnsThreads, opts.host, opts.ns, opts.nPort);
+ opts.nDnsThreads, opts.host.c_str(), opts.ns.c_str(),
+ opts.nPort);
dnsThread.clear();
for (int i = 0; i < opts.nDnsThreads; i++) {
dnsThread.push_back(new CDnsThread(&opts, i));

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 07:58 (14 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4584208
Default Alt Text
D4251.id13545.diff (5 KB)

Event Timeline