Skip to content

Commit e35c4a3

Browse files
committed
Merge bitcoin/bitcoin#22732: net: use m_client_interface rather than uiInterface
d8ba632 scripted-diff: replace clientInterface with m_client_interface in net (fanquake) f68c6ce net: use clientInterface rather than uiInterface (fanquake) Pull request description: First commit fixes two cases where we were using `uiInterface`, rather than `clientInterface`. Second commit renames `clientInterface` to `m_client_interface`, to match banman. ACKs for top commit: hebasto: ACK d8ba632, verified that `uiInterface` is replaced in all sites. Zero-1729: crACK d8ba632 Tree-SHA512: 9c893d8799b0bc7737836c16e11b77b6f9dffa31041ec6678e63cad958ea06da09a841b99cc61c1b4d9f6f4f1be397ca5a8d2fb2fb7ab08c9437043f8a57c3dc
2 parents bb9f76a + d8ba632 commit e35c4a3

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

src/net.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,8 +1304,9 @@ void CConnman::NotifyNumConnectionsChanged()
13041304
}
13051305
if(vNodesSize != nPrevNodeCount) {
13061306
nPrevNodeCount = vNodesSize;
1307-
if(clientInterface)
1308-
clientInterface->NotifyNumConnectionsChanged(vNodesSize);
1307+
if (m_client_interface) {
1308+
m_client_interface->NotifyNumConnectionsChanged(vNodesSize);
1309+
}
13091310
}
13101311
}
13111312

@@ -2448,7 +2449,9 @@ void CConnman::SetNetworkActive(bool active)
24482449

24492450
fNetworkActive = active;
24502451

2451-
uiInterface.NotifyNetworkActiveChanged(fNetworkActive);
2452+
if (m_client_interface) {
2453+
m_client_interface->NotifyNetworkActiveChanged(fNetworkActive);
2454+
}
24522455
}
24532456

24542457
CConnman::CConnman(uint64_t nSeed0In, uint64_t nSeed1In, CAddrMan& addrman_in, bool network_active)
@@ -2473,8 +2476,8 @@ bool CConnman::Bind(const CService &addr, unsigned int flags, NetPermissionFlags
24732476
}
24742477
bilingual_str strError;
24752478
if (!BindListenPort(addr, strError, permissions)) {
2476-
if ((flags & BF_REPORT_ERROR) && clientInterface) {
2477-
clientInterface->ThreadSafeMessageBox(strError, "", CClientUIInterface::MSG_ERROR);
2479+
if ((flags & BF_REPORT_ERROR) && m_client_interface) {
2480+
m_client_interface->ThreadSafeMessageBox(strError, "", CClientUIInterface::MSG_ERROR);
24782481
}
24792482
return false;
24802483
}
@@ -2513,8 +2516,8 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
25132516
Init(connOptions);
25142517

25152518
if (fListen && !InitBinds(connOptions)) {
2516-
if (clientInterface) {
2517-
clientInterface->ThreadSafeMessageBox(
2519+
if (m_client_interface) {
2520+
m_client_interface->ThreadSafeMessageBox(
25182521
_("Failed to listen on any port. Use -listen=0 if you want this."),
25192522
"", CClientUIInterface::MSG_ERROR);
25202523
}
@@ -2531,8 +2534,8 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
25312534
AddAddrFetch(strDest);
25322535
}
25332536

2534-
if (clientInterface) {
2535-
clientInterface->InitMessage(_("Loading P2P addresses…").translated);
2537+
if (m_client_interface) {
2538+
m_client_interface->InitMessage(_("Loading P2P addresses…").translated);
25362539
}
25372540
// Load addresses from peers.dat
25382541
int64_t nStart = GetTimeMillis();
@@ -2556,7 +2559,9 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
25562559
LogPrintf("%i block-relay-only anchors will be tried for connections.\n", m_anchors.size());
25572560
}
25582561

2559-
uiInterface.InitMessage(_("Starting network threads…").translated);
2562+
if (m_client_interface) {
2563+
m_client_interface->InitMessage(_("Starting network threads…").translated);
2564+
}
25602565

25612566
fAddressesInitialized = true;
25622567

@@ -2594,8 +2599,8 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
25942599
threadOpenAddedConnections = std::thread(&util::TraceThread, "addcon", [this] { ThreadOpenAddedConnections(); });
25952600

25962601
if (connOptions.m_use_addrman_outgoing && !connOptions.m_specified_outgoing.empty()) {
2597-
if (clientInterface) {
2598-
clientInterface->ThreadSafeMessageBox(
2602+
if (m_client_interface) {
2603+
m_client_interface->ThreadSafeMessageBox(
25992604
_("Cannot provide specific connections and have addrman find outgoing connections at the same."),
26002605
"", CClientUIInterface::MSG_ERROR);
26012606
}

src/net.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ class CConnman
787787
nMaxAddnode = connOptions.nMaxAddnode;
788788
nMaxFeeler = connOptions.nMaxFeeler;
789789
m_max_outbound = m_max_outbound_full_relay + m_max_outbound_block_relay + nMaxFeeler;
790-
clientInterface = connOptions.uiInterface;
790+
m_client_interface = connOptions.uiInterface;
791791
m_banman = connOptions.m_banman;
792792
m_msgproc = connOptions.m_msgproc;
793793
nSendBufferMaxSize = connOptions.nSendBufferMaxSize;
@@ -1126,7 +1126,7 @@ class CConnman
11261126
int nMaxFeeler;
11271127
int m_max_outbound;
11281128
bool m_use_addrman_outgoing;
1129-
CClientUIInterface* clientInterface;
1129+
CClientUIInterface* m_client_interface;
11301130
NetEventsInterface* m_msgproc;
11311131
/** Pointer to this node's banman. May be nullptr - check existence before dereferencing. */
11321132
BanMan* m_banman;

0 commit comments

Comments
 (0)