-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Faster opening of masternode connections #3375
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2102,11 +2102,18 @@ void CConnman::ThreadOpenMasternodeConnections() | |
|
|
||
| auto& chainParams = Params(); | ||
|
|
||
| bool didConnect = false; | ||
| while (!interruptNet) | ||
| { | ||
| if (!interruptNet.sleep_for(std::chrono::milliseconds(1000))) | ||
| int sleepTime = 1000; | ||
| if (didConnect) { | ||
| sleepTime = 100; | ||
| } | ||
| if (!interruptNet.sleep_for(std::chrono::milliseconds(sleepTime))) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same line or brackets
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not in the scope of this PR
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really out of scope since you changed |
||
| return; | ||
|
|
||
| didConnect = false; | ||
|
|
||
| std::set<CService> connectedNodes; | ||
| std::set<uint256> connectedProRegTxHashes; | ||
| ForEachNode([&](const CNode* pnode) { | ||
|
|
@@ -2170,6 +2177,8 @@ void CConnman::ThreadOpenMasternodeConnections() | |
| continue; | ||
| } | ||
|
|
||
| didConnect = true; | ||
|
|
||
| mmetaman.GetMetaInfo(connectToDmn->proTxHash)->SetLastOutboundAttempt(nANow); | ||
|
|
||
| OpenMasternodeConnection(CAddress(connectToDmn->pdmnState->addr, NODE_NETWORK)); | ||
|
|
||
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.
could be,
sleepTime = didConnect ? 100 : 1000;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.
Nah, I'm not a fan of the ternary operator. It's horrible to read and understand.