Update ban-state in case of dirty-state during periodic sweep #11616

pull jonasschnelli wants to merge 2 commits into bitcoin:master from jonasschnelli:2017/11/qt_ban changing 1 files +19 −12
  1. jonasschnelli commented at 2:45 AM on November 6, 2017: contributor

    We do currently not update the UI during periodic ban list sweeps (via dump banlist). Fixes #11612

  2. jonasschnelli added the label GUI on Nov 6, 2017
  3. ghost commented at 3:14 AM on November 6, 2017: none

    Great! Just a nit: According to the Developer Notes

    If an if only has a single-statement then-clause, it can appear on the same line as the if, without braces. In every other case, braces are required, and the then and else clauses must appear correctly indented on a new line.

    shouldn't it be written like

    if(clientInterface) clientInterface->BannedListChanged();
    

    or

    if(clientInterface) {
        clientInterface->BannedListChanged();
    }
    

    ?

  4. Update ban-state in case of dirty-state during periodic sweep c8538123a7
  5. in src/net.cpp:471 in 12c9401a61 outdated
     467 | @@ -468,6 +468,10 @@ void CConnman::DumpBanlist()
     468 |          SetBannedSetDirty(false);
     469 |      }
     470 |  
     471 | +    // update UI
    


    laanwj commented at 9:22 AM on November 6, 2017:

    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.


    theuni commented at 7:03 PM on November 7, 2017:

    Agree.

  6. jonasschnelli force-pushed on Nov 9, 2017
  7. jonasschnelli commented at 7:08 PM on November 9, 2017: contributor

    Moved the signal call to SweepBanned().

  8. jonasschnelli commented at 8:52 PM on November 15, 2017: contributor

    Travis is passing now (random issue)

  9. in src/net.cpp:618 in c8538123a7 outdated
     611 | @@ -612,6 +612,11 @@ void CConnman::SweepBanned()
     612 |          else
     613 |              ++it;
     614 |      }
     615 | +
     616 | +    // update UI
     617 | +    if(setBannedIsDirty && clientInterface) {
     618 | +        clientInterface->BannedListChanged();
    


    theuni commented at 11:17 PM on November 15, 2017:

    This needs to be called without cs_setBanned.

  10. theuni commented at 11:19 PM on November 15, 2017: member

    looks good after scoping to avoid holding the lock during the callback.

  11. jonasschnelli commented at 7:41 AM on November 19, 2017: contributor

    Thanks @theuni for the review. lock-de-scoped the signal call part, switched setBannedIsDirty to an atomic. Best reviewed with ?w=1

  12. theuni commented at 3:39 PM on November 19, 2017: member

    @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.

  13. Call BannedListChanged outside of cs_setBanned lock 57ac471a29
  14. jonasschnelli force-pushed on Nov 19, 2017
  15. jonasschnelli commented at 10:52 PM on November 19, 2017: contributor

    @theuni. Thanks. Your right. Just change the approach.

  16. theuni approved
  17. theuni commented at 6:37 PM on November 20, 2017: member

    Looks good, thanks! utACK 57ac471a294fc7039140eed91d217ad1af7fa7af

  18. laanwj commented at 9:43 AM on December 15, 2017: member

    utACK 57ac471

  19. laanwj merged this on Dec 15, 2017
  20. laanwj closed this on Dec 15, 2017

  21. laanwj referenced this in commit 8585bb8f05 on Dec 15, 2017
  22. PastaPastaPasta referenced this in commit 3526ef9fda on Jan 17, 2020
  23. PastaPastaPasta referenced this in commit b117c2f418 on Jan 22, 2020
  24. PastaPastaPasta referenced this in commit 127fef465c on Jan 22, 2020
  25. PastaPastaPasta referenced this in commit e2ba114f87 on Jan 29, 2020
  26. PastaPastaPasta referenced this in commit a648022eaf on Jan 29, 2020
  27. PastaPastaPasta referenced this in commit e1cd0f2a85 on Jan 29, 2020
  28. PastaPastaPasta referenced this in commit b9e3ae689a on Jan 31, 2020
  29. ckti referenced this in commit f79f3d9b99 on Mar 28, 2021
  30. gades referenced this in commit dac710680f on Jun 25, 2021
  31. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me