Page MenuHomePhabricator

net: split CConnman::SocketHandler()
ClosedPublic

Authored by PiRK on Mon, Nov 11, 19:04.

Details

Reviewers
roqqit
Group Reviewers
Restricted Project
Commits
rABCd8719d90bb5c: net: split CConnman::SocketHandler()
Summary

CConnman::SocketHandler() does 3 things:

  1. Check sockets for readiness
  2. Process ready listening sockets
  3. Process ready connected sockets

Split the processing (2. and 3.) into separate methods to make the code
easier to grasp.

Also, move the processing of listening sockets after the processing of
connected sockets to make it obvious that there is no dependency and
also explicitly release the snapshot before dealing with listening
sockets - it is only necessary for the connected sockets part.

This concludes backport of core#21943
https://github.com/bitcoin/bitcoin/pull/21943/commits/f52b6b2d9f482353821da0ef4c485c402a396c8

Depends on D17107

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Mon, Nov 11, 19:04

Tail of the build log:

[392/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[393/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[394/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/coins.cpp.o
[395/577] Building CXX object src/CMakeFiles/server.dir/node/blockstorage.cpp.o
[396/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[397/577] Building CXX object src/CMakeFiles/server.dir/rpc/server_util.cpp.o
[398/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[399/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[400/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[401/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[402/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[403/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[404/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[405/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[406/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[407/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[408/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[409/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[410/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[411/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[412/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[413/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[414/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[415/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[416/577] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[417/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[418/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[419/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[420/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[421/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[422/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[423/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[424/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[425/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[426/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[427/577] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[428/577] Linking CXX static library src/wallet/libwallet.a
[429/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[430/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[431/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[432/577] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[433/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[434/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[435/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[436/577] Linking CXX executable src/iguana/iguana
[437/577] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[438/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[439/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[440/577] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[441/577] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[442/577] Building CXX object src/CMakeFiles/server.dir/rpc/net.cpp.o
[443/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[444/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[445/577] Building CXX object src/CMakeFiles/server.dir/rpc/mining.cpp.o
[446/577] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[447/577] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[448/577] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[449/577] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1

Tail of the build log:

[391/575] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[392/575] Linking CXX executable src/bitcoin-tx
[393/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[394/575] Building CXX object src/CMakeFiles/bitcoin-wallet.dir/bitcoin-wallet.cpp.o
[395/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/coins.cpp.o
[396/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[397/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[398/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[399/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[400/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[401/575] Building CXX object src/CMakeFiles/server.dir/rpc/mining.cpp.o
[402/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[403/575] Building CXX object src/CMakeFiles/server.dir/rpc/net.cpp.o
[404/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[405/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[406/575] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[407/575] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[408/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[409/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[410/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[411/575] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[412/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[413/575] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[414/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[415/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[416/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[417/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[418/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[419/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[420/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[421/575] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[422/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[423/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[424/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[425/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[426/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[427/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[428/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[429/575] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[430/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[431/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[432/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[433/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[434/575] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[435/575] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[436/575] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[437/575] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[438/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[439/575] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[440/575] Linking CXX executable src/iguana/iguana
[441/575] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[442/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[443/575] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[444/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[445/575] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[446/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[447/575] Linking CXX static library src/wallet/libwallet.a
[448/575] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1
PiRK planned changes to this revision.Mon, Nov 11, 19:23

lock issue or lock annotation issue to be investigated

add missing lock annotation

roqqit requested changes to this revision.Tue, Nov 12, 18:31
roqqit added a subscriber: roqqit.
roqqit added inline comments.
src/net.cpp
1779 ↗(On Diff #50801)

remove. this line is supersceded by the one immediately above

This revision now requires changes to proceed.Tue, Nov 12, 18:31
This revision is now accepted and ready to land.Wed, Nov 13, 16:47
This revision was automatically updated to reflect the committed changes.