-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Randomly choose from all available IP addresses #220
Conversation
This is to avoid getting stuck on the same IP which doesn't work for whatever reason. pool.supportxmr.com uses DNS for load balancing, and it had issues with xmr-stak miners when one of the servers went down and all xmr-stak miners that were on that server didn't switch to the other working server. This change fixes the bug.
Thanks! xref to previous - pr #219 |
pSockAddr = ipv6; | ||
else if (ipv4 != nullptr && ipv6 != nullptr) | ||
else if (!ipv4.empty() && ipv6.empty()) | ||
pSockAddr = ipv4[rand() % ipv4.size()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rand()
must be initialized with std::srand(std::time(0));
else the random numbers are always the some after the start. documentation rand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it
Sigh, we broke the mac build. This needs to be fixed before merging. |
Fixed it. Stupid Apple not respecting C++ standard... |
Looking good now. @psychocrypt I verified that rand() is correctly seeded now (at least on gcc, don't expect any additional trouble on msvc). Thanks @SChernykh ! |
This is to avoid getting stuck on the same IP which doesn't work for whatever reason.
pool.supportxmr.com uses DNS for load balancing, and it had issues with xmr-stak miners when one of the servers went down and all xmr-stak miners that were on that server didn't switch to the other working server. This change fixes the bug.