bitcoin/src
Wladimir J. van der Laan a1be08405d
Merge #20788: net: add RAII socket and use it instead of bare SOCKET
615ba0eb96 test: add Sock unit tests (Vasil Dimov)
7bd21ce1ef style: rename hSocket to sock (Vasil Dimov)
04ae846904 net: use Sock in InterruptibleRecv() and Socks5() (Vasil Dimov)
ba9d73268f net: add RAII socket and use it instead of bare SOCKET (Vasil Dimov)
dec9b5e850 net: move CloseSocket() from netbase to util/sock (Vasil Dimov)
aa17a44551 net: move MillisToTimeval() from netbase to util/time (Vasil Dimov)

Pull request description:

  Introduce a class to manage the lifetime of a socket - when the object
  that contains the socket goes out of scope, the underlying socket will
  be closed.

  In addition, the new `Sock` class has a `Send()`, `Recv()` and `Wait()`
  methods that can be overridden by unit tests to mock the socket
  operations.

  The `Wait()` method also hides the
  `#ifdef USE_POLL poll() #else select() #endif` technique from higher
  level code.

ACKs for top commit:
  laanwj:
    Re-ACK 615ba0eb96
  jonatack:
    re-ACK 615ba0eb96

Tree-SHA512: 3003e6bc0259295ca0265ccdeb1522ee25b4abe66d32e6ceaa51b55e0a999df7ddee765f86ce558a788c1953ee2009bfa149b09d494593f7d799c0d7d930bee8
2021-02-11 14:07:33 +01:00
..
bench Merge #21059: Drop boost/preprocessor dependencies 2021-02-02 12:44:27 +01:00
compat Support glibc-back-compat on 64-bit POWER 2021-01-19 14:41:22 +01:00
config
consensus scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
crc32c build: Update crc32c subtree 2020-12-08 19:26:30 +01:00
crypto Merge #19055: Add MuHash3072 implementation 2021-01-07 17:57:17 +01:00
index validation: Move FindForkInGlobalIndex to BlockManager 2021-01-28 14:15:26 -05:00
interfaces net: Add -natpmp command line option 2021-01-07 18:07:09 +02:00
leveldb
logging
node validation: Move FindForkInGlobalIndex to BlockManager 2021-01-28 14:15:26 -05:00
policy refactor: Use C++17 std::array deduction for ALL_FEE_ESTIMATE_HORIZONS 2021-01-03 18:38:31 +01:00
primitives scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
qt Merge bitcoin-core/gui#203: Display plain "Inbound" in peer details 2021-02-05 18:48:39 +01:00
rpc Merge #21043: net: Avoid UBSan warning in ProcessMessage(...) 2021-02-11 12:40:12 +01:00
script Merge #20211: Use -Wswitch for TxoutType where possible 2021-02-11 11:48:12 +01:00
secp256k1 Update secp256k1 subtree to latest master 2020-10-27 23:08:48 -07:00
support Merge #20464: refactor: Treat CDataStream bytes as uint8_t 2021-02-01 15:17:28 +01:00
test Merge #20788: net: add RAII socket and use it instead of bare SOCKET 2021-02-11 14:07:33 +01:00
univalue Update univalue subtree 2020-11-19 15:48:24 +01:00
util Merge #20788: net: add RAII socket and use it instead of bare SOCKET 2021-02-11 14:07:33 +01:00
wallet Merge #20211: Use -Wswitch for TxoutType where possible 2021-02-11 11:48:12 +01:00
zmq rpc: Remove duplicate name and argNames from CRPCCommand 2021-01-28 08:19:52 +01:00
.clang-format tools: clang-format 6 compatibility 2020-07-06 03:52:37 +02:00
addrdb.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
addrdb.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
addrman.cpp refactor: remove boost::thread_group usage 2021-01-29 15:39:44 +08:00
addrman.h [addrman] Don't repeat "Bucketing method was updated" log multiple times 2021-01-29 12:39:55 +00:00
amount.h
arith_uint256.cpp
arith_uint256.h
attributes.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
banman.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
banman.h Clean up separated ban/discourage interface 2020-07-03 20:43:55 -07:00
base58.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
base58.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
bech32.cpp
bech32.h
bitcoin-cli-res.rc Drop the leading 0 from the version number 2020-11-18 12:00:57 -05:00
bitcoin-cli.cpp netinfo: display only outbound block relay counts 2021-02-03 14:18:20 +01:00
bitcoin-tx-res.rc Drop the leading 0 from the version number 2020-11-18 12:00:57 -05:00
bitcoin-tx.cpp Move TX_MAX_STANDARD_VERSION to policy 2020-12-10 11:12:08 +01:00
bitcoin-util-res.rc Add bitcoin-util command line utility 2021-01-12 18:34:25 +10:00
bitcoin-util.cpp Merge #20938: build: fix linking against -latomic when building for riscv 2021-01-18 18:33:24 +01:00
bitcoin-wallet-res.rc Drop the leading 0 from the version number 2020-11-18 12:00:57 -05:00
bitcoin-wallet.cpp util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet 2021-01-21 19:31:28 +01:00
bitcoind-res.rc Drop the leading 0 from the version number 2020-11-18 12:00:57 -05:00
bitcoind.cpp init: Signal-safe instant shutdown 2020-12-15 17:21:06 +01:00
blockencodings.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
blockencodings.h
blockfilter.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
blockfilter.h
bloom.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
bloom.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
chain.cpp
chain.h chain: Remove UB CChain comparison 2020-08-27 20:07:27 -04:00
chainparams.cpp Move signet onion seed from v2 to v3 2020-12-15 14:12:01 +01:00
chainparams.h Remove gArgs global from CreateChainParams to aid testing 2020-09-29 10:20:05 +02:00
chainparamsbase.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
chainparamsbase.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
chainparamsseeds.h net: Hardcoded seeds update for 0.21 2020-10-25 14:25:00 +01:00
checkqueue.h refactor: Drop boost::thread stuff in CCheckQueue 2020-09-24 06:55:34 +03:00
clientversion.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
clientversion.h refactor: Move STRINGIZE macro to macros.h 2021-02-01 22:30:05 +02:00
coins.cpp Merge #19935: Move SaltedHashers to separate file and add some new ones 2021-01-13 08:49:17 +01:00
coins.h Move Hashers to util/hasher.{cpp/h} 2020-11-10 14:33:37 -05:00
compat.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
compressor.cpp
compressor.h
core_io.h doc: fix various typos 2021-01-04 12:31:31 +08:00
core_memusage.h
core_read.cpp doc: fix various typos 2021-01-04 12:31:31 +08:00
core_write.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
cuckoocache.h doc: Use https URLs where possible 2021-01-04 12:23:16 +08:00
dbwrapper.cpp
dbwrapper.h Merge #20464: refactor: Treat CDataStream bytes as uint8_t 2021-02-01 15:17:28 +01:00
dummywallet.cpp wallet: Remove -upgradewallet from dummywallet 2020-11-04 12:16:57 -05:00
flatfile.cpp Fix possible data race when committing block files 2020-08-25 16:46:46 +00:00
flatfile.h
fs.cpp Replace fs::absolute calls with AbsPathJoin calls 2021-01-15 22:48:15 +01:00
fs.h Replace fs::absolute calls with AbsPathJoin calls 2021-01-15 22:48:15 +01:00
hash.cpp doc: Use https URLs where possible 2021-01-04 12:23:16 +08:00
hash.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
httprpc.cpp rpc: Validate -rpcauth arguments 2020-11-23 21:02:54 +00:00
httprpc.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
httpserver.cpp net: Drop unneeded headers when compat.h included 2020-10-22 21:45:20 +03:00
httpserver.h
indirectmap.h
init.cpp Merge #21077: doc: clarify -timeout and -peertimeout config options 2021-02-05 10:21:01 +01:00
init.h Don't make "in" parameters look like "out"/"in-out" parameters: pass by ref to const instead of ref to non-const 2020-12-06 00:22:40 +00:00
key.cpp doc: Use https URLs where possible 2021-01-04 12:23:16 +08:00
key.h
key_io.cpp Better error messages for invalid addresses 2021-01-24 02:44:53 +01:00
key_io.h Better error messages for invalid addresses 2021-01-24 02:44:53 +01:00
logging.cpp Don't declare de facto const member functions as non-const 2020-12-06 18:44:25 +00:00
logging.h Don't declare de facto const member functions as non-const 2020-12-06 18:44:25 +00:00
Makefile.am Merge #20788: net: add RAII socket and use it instead of bare SOCKET 2021-02-11 14:07:33 +01:00
Makefile.bench.include net: Add libnatpmp support 2021-01-07 18:07:09 +02:00
Makefile.crc32c.include build: Update crc32c subtree 2020-12-08 19:26:30 +01:00
Makefile.leveldb.include
Makefile.qt.include Merge bitcoin-core/gui#176: Fix TxViewDelegate layout 2021-01-21 18:54:19 +01:00
Makefile.qt_locale.include qt: Pre-splitoff translations update 2020-10-27 19:40:44 +01:00
Makefile.qttest.include net: Add libnatpmp support 2021-01-07 18:07:09 +02:00
Makefile.test.include Merge #20788: net: add RAII socket and use it instead of bare SOCKET 2021-02-11 14:07:33 +01:00
Makefile.test_fuzz.include fuzz: move-only FillNode implementation to cpp file 2021-01-23 20:01:12 +01:00
Makefile.test_util.include test: Mock IBD in net_processing fuzzers 2020-11-07 07:50:59 +01:00
mapport.cpp net: Add -natpmp command line option 2021-01-07 18:07:09 +02:00
mapport.h net: Add -natpmp command line option 2021-01-07 18:07:09 +02:00
memusage.h
merkleblock.cpp doc: fix various typos 2021-01-04 12:31:31 +08:00
merkleblock.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
miner.cpp validation: Pass in chainstate to TestBlockValidity 2021-01-28 14:15:26 -05:00
miner.h Don't declare de facto const member functions as non-const 2020-12-06 18:44:25 +00:00
net.cpp Merge #20788: net: add RAII socket and use it instead of bare SOCKET 2021-02-11 14:07:33 +01:00
net.h doc: refer to BIPs 339/155 in feature negotiation 2021-02-02 14:49:06 +01:00
net_permissions.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
net_permissions.h Reduce MAX_PEER_TX_ANNOUNCEMENTS for non-PF_RELAY peers 2020-10-12 12:14:53 -07:00
net_processing.cpp Merge #21043: net: Avoid UBSan warning in ProcessMessage(...) 2021-02-11 12:40:12 +01:00
net_processing.h net_processing: move Peer definition to .cpp 2021-01-09 23:27:45 +10:00
net_types.h
netaddress.cpp net: allow CSubNet of non-IP networks 2021-01-10 15:51:15 +01:00
netaddress.h Merge #20852: net: allow CSubNet of non-IP networks 2021-01-11 11:27:47 +01:00
netbase.cpp style: rename hSocket to sock 2021-02-10 13:30:09 +01:00
netbase.h style: rename hSocket to sock 2021-02-10 13:30:09 +01:00
netmessagemaker.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
noui.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
noui.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
optional.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
outputtype.cpp refactor: Use C++17 std::array deduction for OUTPUT_TYPES 2021-01-03 18:37:59 +01:00
outputtype.h refactor: Use C++17 std::array deduction for OUTPUT_TYPES 2021-01-03 18:37:59 +01:00
pow.cpp
pow.h
prevector.h
protocol.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
protocol.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
psbt.cpp Merge #20464: refactor: Treat CDataStream bytes as uint8_t 2021-02-01 15:17:28 +01:00
psbt.h scripted-diff: Use [[nodiscard]] (C++17) instead of NODISCARD 2020-11-26 09:05:59 +00:00
pubkey.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
pubkey.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
random.cpp Merge #17563: lib: fix a compiler warning: unused GetDevURandom() 2020-08-10 21:30:42 +08:00
random.h
randomenv.cpp util: Allow use of C++14 chrono literals 2020-12-08 16:47:36 +01:00
randomenv.h
rest.cpp scripted-diff: Use BlockManager::LookupBlockIndex 2021-01-28 14:15:26 -05:00
reverse_iterator.h
scheduler.cpp Add include for std::bind. 2021-01-13 02:05:00 +01:00
scheduler.h refactor: remove boost::thread_group usage 2021-01-29 15:39:44 +08:00
serialize.h Support bypassing range check in ReadCompactSize 2020-10-09 10:32:19 +02:00
shutdown.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
shutdown.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
signet.cpp refactor: Remove SignetTxs::m_valid and use optional instead 2020-09-22 22:31:31 +02:00
signet.h refactor: Remove SignetTxs::m_valid and use optional instead 2020-09-22 22:31:31 +02:00
span.h Merge #19387: span: update constructors to match c++20 draft spec and add lifetimebound attribute 2020-11-25 15:18:33 +01:00
streams.h Merge #20464: refactor: Treat CDataStream bytes as uint8_t 2021-02-01 15:17:28 +01:00
sync.cpp refactor: remove straggling boost::mutex usage 2021-01-26 15:57:28 +08:00
sync.h Merge #20495: sync: Use decltype(auto) return type for WITH_LOCK 2021-01-12 15:56:19 +08:00
threadinterrupt.cpp
threadinterrupt.h
threadsafety.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
timedata.cpp Avoid the use of abs64 in timedata 2020-10-12 19:50:16 -07:00
timedata.h
tinyformat.h refactor: Improve use of explicit keyword 2020-12-01 18:36:39 +01:00
torcontrol.cpp Merge #20788: net: add RAII socket and use it instead of bare SOCKET 2021-02-11 14:07:33 +01:00
torcontrol.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
txdb.cpp Merge #18637: coins: allow cache resize after init 2020-07-29 07:53:19 +02:00
txdb.h txdb: add CCoinsViewDB::ChangeCacheSize 2020-07-01 14:44:24 -04:00
txmempool.cpp Merge #20944: rpc: Return total fee in getmempoolinfo 2021-02-08 20:36:46 +01:00
txmempool.h rpc: Return total fee in mempool 2021-01-28 10:43:22 +01:00
txrequest.cpp refactor: Improve use of explicit keyword 2020-12-01 18:36:39 +01:00
txrequest.h Report and verify expirations 2020-10-12 12:14:53 -07:00
uint256.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
uint256.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
undo.h
validation.cpp validation: Guard all chainstates with cs_main 2021-02-01 22:09:03 -05:00
validation.h validation: Guard all chainstates with cs_main 2021-02-01 22:09:03 -05:00
validationinterface.cpp Add 'sequence' zmq publisher to track all block (dis)connects, mempool deltas 2020-09-22 11:34:30 -04:00
validationinterface.h Add 'sequence' zmq publisher to track all block (dis)connects, mempool deltas 2020-09-22 11:34:30 -04:00
version.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
versionbits.cpp
versionbits.h
versionbitsinfo.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
versionbitsinfo.h
walletinitinterface.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
warnings.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
warnings.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00