diff options
| author | Wladimir J. van der Laan <[email protected]> | 2019-01-09 17:04:16 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2019-01-09 17:12:54 +0100 |
| commit | 854ca855ab33a3563f138d628bc94e8aee121819 (patch) | |
| tree | 197963a853275e9e1ac8b8898b9859dfeb4da7a5 /src/net.cpp | |
| parent | Merge #15117: Fix invalid memory write in case of failing mmap(...) in PosixL... (diff) | |
| parent | IsReachable is the inverse of IsLimited (DRY). Includes unit tests (diff) | |
| download | discoin-854ca855ab33a3563f138d628bc94e8aee121819.tar.xz discoin-854ca855ab33a3563f138d628bc94e8aee121819.zip | |
Merge #15051: Tests: IsReachable is the inverse of IsLimited (DRY). Includes unit tests
6dc4593db1ccfb8745b2daa42f457981ae08dba9 IsReachable is the inverse of IsLimited (DRY). Includes unit tests (marcaiaf)
Pull request description:
IsReachable is the inverse of IsLimited, but the implementation is duplicated (DRY)
- Changed the implementation accordingly.
- Added unit tests to document behavior and relationship
- My modification in net.cpp applies only to IsReachable.
- Applied clang-format-diffpy
Created new pull request to avoid the mess with:
https://github.com/bitcoin/bitcoin/pull/15044
Checked with supposedly conflicting PRs mentioned in the old PR. No conflicts with the specific changes in this PR.
Tree-SHA512: b132dec6cc2c788ebe4f63f228d78f441614e156743b17adebc990de0180a5872874d2724c86eeaa470b4521918bd137b0e33ebcaae77c5efc1f0d56104f6c87
Diffstat (limited to 'src/net.cpp')
| -rw-r--r-- | src/net.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/net.cpp b/src/net.cpp index 03ee7af5e..86e522583 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -295,15 +295,13 @@ bool IsLocal(const CService& addr) /** check whether a given network is one we can probably connect to */ bool IsReachable(enum Network net) { - LOCK(cs_mapLocalHost); - return !vfLimited[net]; + return !IsLimited(net); } /** check whether a given address is in a network we can probably connect to */ bool IsReachable(const CNetAddr& addr) { - enum Network net = addr.GetNetwork(); - return IsReachable(net); + return IsReachable(addr.GetNetwork()); } |