From 34bcfab562bac9887ca9c3831cf4fd0ee7f98149 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 4 Dec 2020 15:10:09 +0100 Subject: net: move the constant maxWait out of InterruptibleRecv() Move `maxWait` out of `InterruptibleRecv()` and rename it to `MAX_WAIT_FOR_IO` so that it can be reused by other code. --- src/util/sock.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/util') diff --git a/src/util/sock.h b/src/util/sock.h index 26fe60f18f..23c3c35dad 100644 --- a/src/util/sock.h +++ b/src/util/sock.h @@ -6,10 +6,17 @@ #define BITCOIN_UTIL_SOCK_H #include +#include #include #include +/** + * Maximum time to wait for I/O readiness. + * It will take up until this time to break off in case of an interruption. + */ +static constexpr auto MAX_WAIT_FOR_IO = 1s; + /** * RAII helper class that manages a socket. Mimics `std::unique_ptr`, but instead of a pointer it * contains a socket and closes it automatically when it goes out of scope. -- cgit v1.2.3