mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
net: dedup MSG_NOSIGNAL and MSG_DONTWAIT definitions
Deduplicate `MSG_NOSIGNAL` and `MSG_DONTWAIT` definitions from `net.cpp` and `netbase.cpp` to `compat.h` where they can also be reused by other code.
This commit is contained in:
parent
34bcfab562
commit
78fdfbea66
3 changed files with 12 additions and 14 deletions
10
src/compat.h
10
src/compat.h
|
@ -96,4 +96,14 @@ bool static inline IsSelectableSocket(const SOCKET& s) {
|
|||
#endif
|
||||
}
|
||||
|
||||
// MSG_NOSIGNAL is not available on some platforms, if it doesn't exist define it as 0
|
||||
#if !defined(MSG_NOSIGNAL)
|
||||
#define MSG_NOSIGNAL 0
|
||||
#endif
|
||||
|
||||
// MSG_DONTWAIT is not available on some platforms, if it doesn't exist define it as 0
|
||||
#if !defined(MSG_DONTWAIT)
|
||||
#define MSG_DONTWAIT 0
|
||||
#endif
|
||||
|
||||
#endif // BITCOIN_COMPAT_H
|
||||
|
|
11
src/net.cpp
11
src/net.cpp
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <banman.h>
|
||||
#include <clientversion.h>
|
||||
#include <compat.h>
|
||||
#include <consensus/consensus.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <net_permissions.h>
|
||||
|
@ -72,16 +73,6 @@ static constexpr std::chrono::seconds MAX_UPLOAD_TIMEFRAME{60 * 60 * 24};
|
|||
// We add a random period time (0 to 1 seconds) to feeler connections to prevent synchronization.
|
||||
#define FEELER_SLEEP_WINDOW 1
|
||||
|
||||
// MSG_NOSIGNAL is not available on some platforms, if it doesn't exist define it as 0
|
||||
#if !defined(MSG_NOSIGNAL)
|
||||
#define MSG_NOSIGNAL 0
|
||||
#endif
|
||||
|
||||
// MSG_DONTWAIT is not available on some platforms, if it doesn't exist define it as 0
|
||||
#if !defined(MSG_DONTWAIT)
|
||||
#define MSG_DONTWAIT 0
|
||||
#endif
|
||||
|
||||
/** Used to pass flags to the Bind() function */
|
||||
enum BindFlags {
|
||||
BF_NONE = 0,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <netbase.h>
|
||||
|
||||
#include <compat.h>
|
||||
#include <sync.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/sock.h>
|
||||
|
@ -30,10 +31,6 @@
|
|||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
#if !defined(MSG_NOSIGNAL)
|
||||
#define MSG_NOSIGNAL 0
|
||||
#endif
|
||||
|
||||
// Settings
|
||||
static Mutex g_proxyinfo_mutex;
|
||||
static proxyType proxyInfo[NET_MAX] GUARDED_BY(g_proxyinfo_mutex);
|
||||
|
|
Loading…
Add table
Reference in a new issue