Code cleanup #462

pull muggenhor wants to merge 6 commits into bitcoin:master from muggenhor:code-cleanup changing 13 files +632 −482
  1. muggenhor commented at 5:16 PM on August 11, 2011: contributor

    General code cleanup in preparation of some much needed improvements to the networking code.

  2. gavinandresen commented at 5:45 PM on August 11, 2011: contributor

    NACK on the protocol.hpp (we don't have other hpp files, I dont' see a good reason to start now-- moving non-performance-critical code from .h to the .cpp I support), and on asserting copyright to protocol.hpp (I just pulled Matt's standardization of making the copyright "Bitcoin Developers")

    ACK on the other cleanups.

  3. muggenhor commented at 10:33 PM on August 11, 2011: contributor

    By protocol.hpp I assume you mean to reject the extension? Changed that to protocol.h instead.

    The copyright header I took from the head of another file now.

    Ammended and forced-updated these commits.

  4. muggenhor commented at 10:35 PM on August 11, 2011: contributor

    PS I was thinking it might be an even better idea to move every single message class to a single source/header file, e.g. src/protocol/$msg.(cpp|h). Any thoughts on that?

  5. gavinandresen commented at 11:18 PM on August 11, 2011: contributor

    Separate source/header for each message wouldn't fit the rest of the project's 'style.' We've rejected other proposed re-orgs that did two-files-per-class.

  6. muggenhor commented at 11:59 PM on August 11, 2011: contributor

    Right, my intention was to move all classes related to the bitcoin wire protocol into protocol.(cpp|h). This to allow the actual transport (across a TCP socket, or something else if desired) to remain separated from protocol decoding/encoding and event handling (the latter is currently already split from networking and resides in main.cpp).

    So no two-files-per-class-eritis.

  7. sipa commented at 10:15 AM on August 12, 2011: member

    Nice cleanup - I haven't looked at it in detail yet though.

    My ipv6 branch uses a modified CAddress whose address and port are private (as a comment on your "TODO: make private" there).

  8. Make some global variables less-global (static)
    Explicitly make these global variables less-global to reduce the maximum
    scope of this global state.
    
    In my experience global variables tend to be a major source of bugs. As
    such the less accessible they are the less likely they are to be the
    source of a bug.
    
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    99860de3c9
  9. Cleanup makefiles such that diffs to them are smaller
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    e49b83bb12
  10. Move func 'REF' from util.h to serialize.h
    util.h doesn't use REF, serialize.h does, creating a dependency of
    serialize.h on util.h, but util.h already depends on serialize.h.  To
    resolve this circular dependency the function 'REF' has now been moved
    closer to one of its two points of use.
    
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    82dc6426b4
  11. Start moving protocol-specific code to protocol.[ch]pp
    Move CMessageHeader from net.h to protocol.[ch]pp, with the
    implementation in the .cpp compilation unit (compiling once is enough).
    
    This commit does *not* and should not modify *any* code, it only moves
    it from net.h and splits it across protocol.cpp and protocol.hpp.
    
    Indentation changes aside the closest thing to a modification of code is
    the addition of the 'TODO' comment (the execution of which requires code
    modifications and thus doesn't belong in this commit).
    
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    507fd9d15b
  12. Move CAddress to protocol.[ch]pp
    This commit does *not* and should not modify *any* code, it only moves
    it from net.h and splits it across protocol.cpp and protocol.hpp.
    
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    33e28c9948
  13. Move CInv to protocol.[ch]pp
    This commit does *not* and should not modify *any* code, it only moves
    it from net.h and splits it across protocol.cpp and protocol.hpp.
    
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    e4dde849ae
  14. gavinandresen merged this on Sep 1, 2011
  15. gavinandresen closed this on Sep 1, 2011

  16. dgenr8 referenced this in commit 55bf6a2ab0 on Apr 29, 2017
  17. Losangelosgenetics referenced this in commit aab4ce1844 on Mar 12, 2020
  18. rajarshimaitra referenced this in commit 77f5b6ca62 on Aug 5, 2021
  19. rajarshimaitra referenced this in commit 0f4dbec977 on Aug 5, 2021
  20. rajarshimaitra referenced this in commit a8c2475004 on Aug 5, 2021
  21. 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-29 03:16 UTC

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