Skip to content
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

Merged
merged 3 commits into from
Jul 18, 2017
Merged

Randomly choose from all available IP addresses #220

merged 3 commits into from
Jul 18, 2017

Conversation

SChernykh
Copy link
Contributor

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.

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.
@fireice-uk
Copy link
Owner

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()];
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it

xmrig added a commit to xmrig/xmrig that referenced this pull request Jul 17, 2017
@fireice-uk
Copy link
Owner

Sigh, we broke the mac build. This needs to be fixed before merging.

@SChernykh
Copy link
Contributor Author

Fixed it. Stupid Apple not respecting C++ standard...

@fireice-uk
Copy link
Owner

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 !

@fireice-uk fireice-uk merged commit 752d1b8 into fireice-uk:dev Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants