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
Update ban-state in case of dirty-state during periodic sweep #11616
Conversation
Great! Just a nit: According to the Developer Notes
shouldn't it be written like
or
? |
src/net.cpp
Outdated
@@ -468,6 +468,10 @@ void CConnman::DumpBanlist() | |||
SetBannedSetDirty(false); | |||
} | |||
|
|||
// update UI |
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 think an appropriate place for this would be in SweepBanned()
itself (at the end, if anything changed), as the list is changed there. It just happens to be called from here, but there are other places.
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.
Agree.
12c9401
to
c853812
Compare
Moved the signal call to |
Travis is passing now (random issue) |
src/net.cpp
Outdated
|
||
// update UI | ||
if(setBannedIsDirty && clientInterface) { | ||
clientInterface->BannedListChanged(); |
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 needs to be called without cs_setBanned.
looks good after scoping to avoid holding the lock during the callback. |
Thanks @theuni for the review. |
@jonasschnelli making setBannedIsDirty atomic doesn't work, i'm afraid, as setBanned/setBannedIsDirty must remain in sync. See CConnman::Unban for an example of where an atomic setBannedIsDirty could go out of sync with setBanned if it's unset elsewhere without cs_setBanned. |
b897fb6
to
57ac471
Compare
@theuni. Thanks. Your right. Just change the approach. |
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.
Looks good, thanks! utACK 57ac471
utACK 57ac471 |
… sweep 57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli) c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli) Pull request description: We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes #11612 Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
…eriodic sweep 57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli) c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli) Pull request description: We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes bitcoin#11612 Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
…eriodic sweep 57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli) c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli) Pull request description: We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes bitcoin#11612 Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
…eriodic sweep 57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli) c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli) Pull request description: We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes bitcoin#11612 Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
…eriodic sweep 57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli) c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli) Pull request description: We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes bitcoin#11612 Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
…eriodic sweep 57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli) c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli) Pull request description: We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes bitcoin#11612 Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
…eriodic sweep 57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli) c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli) Pull request description: We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes bitcoin#11612 Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
…eriodic sweep 57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli) c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli) Pull request description: We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes bitcoin#11612 Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
…eriodic sweep 57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli) c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli) Pull request description: We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes bitcoin#11612 Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
We do currently not update the UI during periodic ban list sweeps (via dump banlist).
Fixes #11612