v31.1-roots.1 · Commit 5: [PATCH 05/17] feat(net): preserve Roots peer controls and health view on v31
src/net.h
Before: src/net.h · After: src/net.h
File metadata
index 96a171736ed3555e3997630f242f21721b8061b8..72fa4f7c2c19dfaca9f5889ec54f26ee141997ba 100644
Download original patch · Release notes
Diff rows 1–68 of 68. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
src/net.h
CHANGED
|
@@ -227,6 +227,8 @@ public:
|
|
|
227
227
|
TransportProtocolType m_transport_type;
|
|
228
228
|
/** BIP324 session id string in hex, if any. */
|
|
229
229
|
std::string m_session_id;
|
|
230
|
+
bool m_forced_inbound{false};
|
|
231
|
+
std::chrono::nanoseconds m_cpu_time{0};
|
|
230
232
|
};
|
|
231
233
|
|
|
232
234
|
|
|
@@ -672,6 +674,7 @@ struct CNodeOptions
|
|
|
672
674
|
std::optional<Proxy> proxy_override = {};
|
|
673
675
|
std::unique_ptr<i2p::sam::Session> i2p_sam_session = nullptr;
|
|
674
676
|
bool prefer_evict = false;
|
|
677
|
+
bool forced_inbound{false};
|
|
675
678
|
size_t recv_flood_size{DEFAULT_MAXRECEIVEBUFFER * 1000};
|
|
676
679
|
bool use_v2transport = false;
|
|
677
680
|
};
|
|
@@ -732,6 +735,7 @@ public:
|
|
|
732
735
|
* from the wire. This cleaned string can safely be logged or displayed.
|
|
733
736
|
*/
|
|
734
737
|
std::string cleanSubVer GUARDED_BY(m_subver_mutex){};
|
|
738
|
+
const bool m_forced_inbound{false};
|
|
735
739
|
const bool m_prefer_evict{false}; // This peer is preferred for eviction.
|
|
736
740
|
bool HasPermission(NetPermissionFlags permission) const {
|
|
737
741
|
return NetPermissions::HasFlag(m_permission_flags, permission);
|
|
@@ -896,6 +900,8 @@ public:
|
|
|
896
900
|
std::atomic<std::chrono::seconds> m_last_tx_time{0s};
|
|
897
901
|
|
|
898
902
|
/** Last measured round-trip time. Used only for RPC/GUI stats/debugging.*/
|
|
903
|
+
//! Current connection message-processing CPU time, in nanoseconds.
|
|
904
|
+
std::atomic<int64_t> m_cpu_time{0};
|
|
899
905
|
std::atomic<std::chrono::microseconds> m_last_ping_time{0us};
|
|
900
906
|
|
|
901
907
|
/** Lowest measured round-trip time. Used as an inbound peer eviction
|
|
@@ -1094,6 +1100,8 @@ public:
|
|
|
1094
1100
|
std::vector<NetWhitebindPermissions> vWhiteBinds;
|
|
1095
1101
|
std::vector<CService> vBinds;
|
|
1096
1102
|
std::vector<CService> onion_binds;
|
|
1103
|
+
bool listenonion{false};
|
|
1104
|
+
bool disable_v1conn_clearnet{false};
|
|
1097
1105
|
/// True if the user did not specify -bind= or -whitebind= and thus
|
|
1098
1106
|
/// we should bind on `0.0.0.0` (IPv4) and `::` (IPv6).
|
|
1099
1107
|
bool bind_on_any;
|
|
@@ -1138,6 +1146,9 @@ public:
|
|
|
1138
1146
|
m_added_node_params.push_back({added_node, use_v2transport});
|
|
1139
1147
|
}
|
|
1140
1148
|
}
|
|
1149
|
+
m_normal_binds = connOptions.vBinds;
|
|
1150
|
+
m_listenonion = connOptions.listenonion;
|
|
1151
|
+
m_disable_v1conn_clearnet = connOptions.disable_v1conn_clearnet;
|
|
1141
1152
|
m_onion_binds = connOptions.onion_binds;
|
|
1142
1153
|
whitelist_forcerelay = connOptions.whitelist_forcerelay;
|
|
1143
1154
|
whitelist_relay = connOptions.whitelist_relay;
|
|
@@ -1510,7 +1521,7 @@ private:
|
|
|
1510
1521
|
*/
|
|
1511
1522
|
bool AlreadyConnectedToAddress(const CNetAddr& addr) const;
|
|
1512
1523
|
|
|
1513
|
-
bool AttemptToEvictConnection();
|
|
1524
|
+
bool AttemptToEvictConnection(bool force);
|
|
1514
1525
|
|
|
1515
1526
|
/**
|
|
1516
1527
|
* Open a new P2P connection.
|
|
@@ -1743,6 +1754,13 @@ private:
|
|
|
1743
1754
|
* an address and port that are designated for incoming Tor connections.
|
|
1744
1755
|
*/
|
|
1745
1756
|
std::vector<CService> m_onion_binds;
|
|
1757
|
+
std::vector<CService> m_normal_binds;
|
|
1758
|
+
bool m_listenonion{false};
|
|
1759
|
+
bool m_disable_v1conn_clearnet{false};
|
|
1760
|
+
bool DisableV1OnClearnet(Network net) const
|
|
1761
|
+
{
|
|
1762
|
+
return m_disable_v1conn_clearnet && (net == NET_IPV4 || net == NET_IPV6);
|
|
1763
|
+
}
|
|
1746
1764
|
|
|
1747
1765
|
/**
|
|
1748
1766
|
* flag for adding 'forcerelay' permission to whitelisted inbound
|