Skip to content

Commit

Permalink
merge bitcoin#22732: use m_client_interface rather than uiInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Jan 12, 2025
1 parent 06a8e9c commit 8e2a12a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
27 changes: 16 additions & 11 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2306,10 +2306,11 @@ void CConnman::NotifyNumConnectionsChanged(CMasternodeSync& mn_sync)
mn_sync.Reset();
}

if(nodes_size != nPrevNodeCount) {
if (nodes_size != nPrevNodeCount) {
nPrevNodeCount = nodes_size;
if(clientInterface)
clientInterface->NotifyNumConnectionsChanged(nodes_size);
if (m_client_interface) {
m_client_interface->NotifyNumConnectionsChanged(nodes_size);
}

CalculateNumConnectionsChangedStats();
}
Expand Down Expand Up @@ -4196,7 +4197,9 @@ void CConnman::SetNetworkActive(bool active, CMasternodeSync* const mn_sync)
mn_sync->Reset();
}

uiInterface.NotifyNetworkActiveChanged(fNetworkActive);
if (m_client_interface) {
m_client_interface->NotifyNetworkActiveChanged(fNetworkActive);
}
}

CConnman::CConnman(uint64_t nSeed0In, uint64_t nSeed1In, AddrMan& addrman_in,
Expand Down Expand Up @@ -4225,8 +4228,8 @@ bool CConnman::Bind(const CService& addr_, unsigned int flags, NetPermissionFlag

bilingual_str strError;
if (!BindListenPort(addr, strError, permissions)) {
if ((flags & BF_REPORT_ERROR) && clientInterface) {
clientInterface->ThreadSafeMessageBox(strError, "", CClientUIInterface::MSG_ERROR);
if ((flags & BF_REPORT_ERROR) && m_client_interface) {
m_client_interface->ThreadSafeMessageBox(strError, "", CClientUIInterface::MSG_ERROR);
}
return false;
}
Expand Down Expand Up @@ -4276,8 +4279,8 @@ bool CConnman::Start(CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_met
}

if (fListen && !InitBinds(connOptions)) {
if (clientInterface) {
clientInterface->ThreadSafeMessageBox(
if (m_client_interface) {
m_client_interface->ThreadSafeMessageBox(
_("Failed to listen on any port. Use -listen=0 if you want this."),
"", CClientUIInterface::MSG_ERROR);
}
Expand All @@ -4303,7 +4306,9 @@ bool CConnman::Start(CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_met
LogPrintf("%i block-relay-only anchors will be tried for connections.\n", m_anchors.size());
}

uiInterface.InitMessage(_("Starting network threads…").translated);
if (m_client_interface) {
m_client_interface->InitMessage(_("Starting network threads…").translated);
}

fAddressesInitialized = true;

Expand Down Expand Up @@ -4350,8 +4355,8 @@ bool CConnman::Start(CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_met
threadOpenAddedConnections = std::thread(&util::TraceThread, "addcon", [this] { ThreadOpenAddedConnections(); });

if (connOptions.m_use_addrman_outgoing && !connOptions.m_specified_outgoing.empty()) {
if (clientInterface) {
clientInterface->ThreadSafeMessageBox(
if (m_client_interface) {
m_client_interface->ThreadSafeMessageBox(
_("Cannot provide specific connections and have addrman find outgoing connections at the same time."),
"", CClientUIInterface::MSG_ERROR);
}
Expand Down
4 changes: 2 additions & 2 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ friend class CNode;
nMaxAddnode = connOptions.nMaxAddnode;
nMaxFeeler = connOptions.nMaxFeeler;
m_max_outbound = m_max_outbound_full_relay + m_max_outbound_block_relay + nMaxFeeler;
clientInterface = connOptions.uiInterface;
m_client_interface = connOptions.uiInterface;
m_banman = connOptions.m_banman;
m_msgproc = connOptions.m_msgproc;
nSendBufferMaxSize = connOptions.nSendBufferMaxSize;
Expand Down Expand Up @@ -1879,7 +1879,7 @@ friend class CNode;
int nMaxFeeler;
int m_max_outbound;
bool m_use_addrman_outgoing;
CClientUIInterface* clientInterface;
CClientUIInterface* m_client_interface;
NetEventsInterface* m_msgproc;
/** Pointer to this node's banman. May be nullptr - check existence before dereferencing. */
BanMan* m_banman;
Expand Down

0 comments on commit 8e2a12a

Please sign in to comment.