mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Merge #20788: net: add RAII socket and use it instead of bare SOCKET
615ba0eb96test: add Sock unit tests (Vasil Dimov)7bd21ce1efstyle: rename hSocket to sock (Vasil Dimov)04ae846904net: use Sock in InterruptibleRecv() and Socks5() (Vasil Dimov)ba9d73268fnet: add RAII socket and use it instead of bare SOCKET (Vasil Dimov)dec9b5e850net: move CloseSocket() from netbase to util/sock (Vasil Dimov)aa17a44551net: 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-ACK615ba0eb96jonatack: re-ACK615ba0eb96Tree-SHA512: 3003e6bc0259295ca0265ccdeb1522ee25b4abe66d32e6ceaa51b55e0a999df7ddee765f86ce558a788c1953ee2009bfa149b09d494593f7d799c0d7d930bee8
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <netbase.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <util/time.h>
|
||||
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
|
||||
Reference in New Issue
Block a user