Skip to content

Commit

Permalink
mapport: remove 'use_pcp' argument
Browse files Browse the repository at this point in the history
No need to specify it, that's the only one available now.
  • Loading branch information
darosior committed Oct 28, 2024
1 parent c4e82b8 commit f6855a3
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1827,7 +1827,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
if (node.peerman) node.peerman->SetBestBlock(chain_active_height, std::chrono::seconds{best_block_time});

// Map ports with NAT-PMP
StartMapPort(args.GetBoolArg("-natpmp", DEFAULT_NATPMP));
if (args.GetBoolArg("-natpmp", DEFAULT_NATPMP)) StartMapPort();

CConnman::Options connOptions;
connOptions.m_local_services = g_local_services;
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Node
virtual void resetSettings() = 0;

//! Map port.
virtual void mapPort(bool use_pcp) = 0;
virtual void mapPort() = 0;

//! Get proxy.
virtual bool getProxy(Network net, Proxy& proxy_info) = 0;
Expand Down
9 changes: 2 additions & 7 deletions src/mapport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,9 @@ static void DispatchMapPort()
}
}

static void MapPortProtoSetEnabled(bool enabled)
void StartMapPort()
{
g_mapport_enabled = enabled;
}

void StartMapPort(bool use_pcp)
{
MapPortProtoSetEnabled(use_pcp);
g_mapport_enabled = true;
DispatchMapPort();
}

Expand Down
2 changes: 1 addition & 1 deletion src/mapport.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

static constexpr bool DEFAULT_NATPMP = false;

void StartMapPort(bool use_pcp);
void StartMapPort();
void InterruptMapPort();
void StopMapPort();

Expand Down
2 changes: 1 addition & 1 deletion src/node/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class NodeImpl : public Node
});
args().WriteSettingsFile();
}
void mapPort(bool use_pcp) override { StartMapPort(use_pcp); }
void mapPort() override { StartMapPort(); }
bool getProxy(Network net, Proxy& proxy_info) override { return GetProxy(net, proxy_info); }
size_t getNodeCount(ConnectionDirection flags) override
{
Expand Down
2 changes: 1 addition & 1 deletion src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
case MapPortNatpmp: // core option - can be changed on-the-fly
if (changed()) {
update(value.toBool());
node().mapPort(value.toBool());
if (value.toBool()) node().mapPort();
}
break;
case MinimizeOnClose:
Expand Down

0 comments on commit f6855a3

Please sign in to comment.