-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Trivial] Remove dead code #3753
Conversation
@@ -99,9 +99,7 @@ OverlayImpl::Timer::on_timer(error_code ec) | |||
overlay_.m_peerFinder->once_per_second(); | |||
overlay_.sendEndpoints(); | |||
overlay_.autoConnect(); | |||
|
|||
if ((overlay_.timer_count_ % Tuning::checkIdlePeers) == 0) |
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.
Why is this deleted? This was added so that we don't check for idle peers too frequently.
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.
timer_count_
is initialized to 0 and never updated. It is always 0, and this condition is always true.
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.
oh, right! it's a bug then! it should be incremented.
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.
i see what happened. it used to be this:
if ((++overlay_.timer_count_ % Tuning::checkSeconds) == 0)
overlay_.check();
if ((overlay_.timer_count_ % Tuning::checkIdlePeers) == 0)
overlay_.deleteIdlePeers();
but then two top lines were deleted in one of the unrelated commits.
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.
This doesn't seem like the right PR to fix that bug, but I wouldn't remove the code either. Let's just keep the code for now and open an issue so we don't lose track of this. @gregtatcam can you open an issue?
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.
I opened the issue #3754.
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.
This looks good - thanks for the cleanup. Left two minor comments.
|
||
// Verify backend integrity | ||
backend_->verify(); | ||
*/ |
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.
Let's check with @miguelportilla before removing this and the verify
implementation.
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.
I am okay removing this commented out code. Although the backend verify function isn't used, it could be useful at some point. For instance, the above situation can be addressed by calling verify on the new deterministic backend. I could also see a server startup switch to have the backend be verified at startup.
@@ -99,9 +99,7 @@ OverlayImpl::Timer::on_timer(error_code ec) | |||
overlay_.m_peerFinder->once_per_second(); | |||
overlay_.sendEndpoints(); | |||
overlay_.autoConnect(); | |||
|
|||
if ((overlay_.timer_count_ % Tuning::checkIdlePeers) == 0) |
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.
This doesn't seem like the right PR to fix that bug, but I wouldn't remove the code either. Let's just keep the code for now and open an issue so we don't lose track of this. @gregtatcam can you open an issue?
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.
💯
There is some other functions or things that are dead too
AcceptedLedger::getTxn(int)
at https://github.com/ripple/rippled/blob/develop/src/ripple/app/ledger/AcceptedLedger.h#L72-L73
AutoSocket::{setSSLOnly|setPlayOnly}
at https://github.com/ripple/rippled/blob/develop/src/ripple/net/AutoSocket.h#L80-L89
LedgerReplayTaks::getCountedObjectName
at https://github.com/ripple/rippled/blob/develop/src/ripple/app/ledger/LedgerReplayTask.h#L132-L136
LedgerMaster::getBuildingLedger
at https://github.com/ripple/rippled/blob/develop/src/ripple/app/ledger/impl/LedgerMaster.cpp#L572-L577
LedgerMaster::NO_VALIDATED_LEDGER_AGE
at https://github.com/ripple/rippled/blob/develop/src/ripple/app/ledger/LedgerMaster.h#L76-L77
NetworkOps::{getTxMap|hasTxSet}
at https://github.com/ripple/rippled/blob/develop/src/ripple/app/misc/NetworkOPs.cpp#L366-L372
and also these:
https://github.com/ripple/rippled/blob/develop/src/ripple/app/misc/NetworkOPs.cpp#L144-L145
NetworksOPs::getConsensusLCL
at https://github.com/ripple/rippled/blob/develop/src/ripple/app/misc/NetworkOPs.h#L244-L245
LedgerDeltaAcquire::getCountedObjectName
at https://github.com/ripple/rippled/blob/develop/src/ripple/app/ledger/impl/LedgerDeltaAcquire.h#L114-L118
LedgerReplayTaks::getCountedObjectName
at https://github.com/ripple/rippled/blob/develop/src/ripple/app/ledger/LedgerReplayTask.h#L132-L136
As @cryptobrad said |
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.
👍 Nice cleanups
Thanks for the suggestions! I'll work to include them, and another I identified today, so I'll put the PR in draft mode temporarily. |
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.
Also unused OverlayImpl::serverHandler() and PeerImp::networkID()
What it says on the tin. Unused methods, undefined declarations, unused members, etc.