Skip to content

Commit d093429

Browse files
committed
net: disable v1 connections, reconnections on clearnet
if `-v2onlyclearnet` is turned on, - v1 addresses from addrman aren't selected and manual connections aren't attempted for outbound connections if it's from IPV4/IPV6 networks. - v1 downgrade mechainm is not attempted if v2 connection wasn't successful
1 parent 594c55b commit d093429

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/net.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
455455
std::unique_ptr<i2p::sam::Session> i2p_transient_session;
456456

457457
for (auto& target_addr: connect_to) {
458+
if (DisableV1OnClearnet(target_addr.GetNetClass()) && !use_v2transport) {
459+
continue;
460+
}
458461
if (target_addr.IsValid()) {
459462
const bool use_proxy{GetProxy(target_addr.GetNetwork(), proxy)};
460463
bool proxyConnectionFailed = false;
@@ -1893,7 +1896,7 @@ void CConnman::DisconnectNodes()
18931896
// Add to reconnection list if appropriate. We don't reconnect right here, because
18941897
// the creation of a connection is a blocking operation (up to several seconds),
18951898
// and we don't want to hold up the socket handler thread for that long.
1896-
if (pnode->m_transport->ShouldReconnectV1()) {
1899+
if (pnode->m_transport->ShouldReconnectV1() && !DisableV1OnClearnet(pnode->addr.GetNetClass())) {
18971900
reconnections_to_add.push_back({
18981901
.addr_connect = pnode->addr,
18991902
.grant = std::move(pnode->grantOutbound),

0 commit comments

Comments
 (0)