Disable cmd params depending on compile flags

This commit is contained in:
SChernykh 2023-03-20 09:17:59 +01:00
parent 634039e551
commit d4a57370ef
2 changed files with 8 additions and 0 deletions

View file

@ -100,10 +100,12 @@ Params::Params(int argc, char* argv[])
ok = true; ok = true;
} }
#ifdef WITH_RANDOMX
if (strcmp(argv[i], "--no-randomx") == 0) { if (strcmp(argv[i], "--no-randomx") == 0) {
m_disableRandomX = true; m_disableRandomX = true;
ok = true; ok = true;
} }
#endif
if ((!strcmp(argv[i], "--out-peers") || !strcmp(argv[i], "--outpeers")) && (i + 1 < argc)) { if ((!strcmp(argv[i], "--out-peers") || !strcmp(argv[i], "--outpeers")) && (i + 1 < argc)) {
m_maxOutgoingPeers = std::min(std::max(strtoul(argv[++i], nullptr, 10), 10UL), 450UL); m_maxOutgoingPeers = std::min(std::max(strtoul(argv[++i], nullptr, 10), 10UL), 450UL);
@ -151,10 +153,12 @@ Params::Params(int argc, char* argv[])
ok = true; ok = true;
} }
#ifdef WITH_UPNP
if (strcmp(argv[i], "--no-upnp") == 0) { if (strcmp(argv[i], "--no-upnp") == 0) {
m_upnp = false; m_upnp = false;
ok = true; ok = true;
} }
#endif
if (!ok) { if (!ok) {
fprintf(stderr, "Unknown command line parameter %s\n\n", argv[i]); fprintf(stderr, "Unknown command line parameter %s\n\n", argv[i]);

View file

@ -53,7 +53,11 @@ struct Params
std::string m_socks5Proxy; std::string m_socks5Proxy;
bool m_dns = true; bool m_dns = true;
uint32_t m_p2pExternalPort = 0; uint32_t m_p2pExternalPort = 0;
#ifdef WITH_UPNP
bool m_upnp = true; bool m_upnp = true;
#else
bool m_upnp = false;
#endif
}; };
} // namespace p2pool } // namespace p2pool