aboutsummaryrefslogtreecommitdiff
path: root/src/torcontrol.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2021-02-11 13:21:31 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2021-02-11 14:07:33 +0100
commita1be08405d9bbf771a965dc170ce85ea1ad034c7 (patch)
tree3e5cf94f5d6a393f972ae66cffaeaed066154fe8 /src/torcontrol.cpp
parent685c16fcb2c718154bf3e6114e35fcac351503f2 (diff)
parent615ba0eb96cf131364c1ceca9d3dedf006fa1e1c (diff)
downloadbitcoin-a1be08405d9bbf771a965dc170ce85ea1ad034c7.tar.xz
Merge #20788: net: add RAII socket and use it instead of bare SOCKET
615ba0eb96cf131364c1ceca9d3dedf006fa1e1c test: add Sock unit tests (Vasil Dimov) 7bd21ce1efc363b3e8ea1d51dd1410ccd66820cb style: rename hSocket to sock (Vasil Dimov) 04ae8469049e1f14585aabfb618ae522150240a7 net: use Sock in InterruptibleRecv() and Socks5() (Vasil Dimov) ba9d73268f9585d4b9254adcf54708f88222798b net: add RAII socket and use it instead of bare SOCKET (Vasil Dimov) dec9b5e850c6aad989e814aea5b630b36f55d580 net: move CloseSocket() from netbase to util/sock (Vasil Dimov) aa17a44551c03b00a47854438afe9f2f89b6ea74 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 615ba0eb96cf131364c1ceca9d3dedf006fa1e1c jonatack: re-ACK 615ba0eb96cf131364c1ceca9d3dedf006fa1e1c Tree-SHA512: 3003e6bc0259295ca0265ccdeb1522ee25b4abe66d32e6ceaa51b55e0a999df7ddee765f86ce558a788c1953ee2009bfa149b09d494593f7d799c0d7d930bee8
Diffstat (limited to 'src/torcontrol.cpp')
-rw-r--r--src/torcontrol.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp
index 908ad35e1b..605c77fc3a 100644
--- a/src/torcontrol.cpp
+++ b/src/torcontrol.cpp
@@ -14,6 +14,7 @@
#include <netbase.h>
#include <util/strencodings.h>
#include <util/system.h>
+#include <util/time.h>
#include <deque>
#include <functional>