Browse Source

use shared pointer for RouterInfo's addreses list

pull/1825/head
orignal 2 years ago
parent
commit
d0d0cd8445
  1. 10
      daemon/UPnP.cpp

10
daemon/UPnP.cpp

@ -159,8 +159,9 @@ namespace transport @@ -159,8 +159,9 @@ namespace transport
void UPnP::PortMapping ()
{
const auto& a = context.GetRouterInfo().GetAddresses();
for (const auto& address : a)
auto a = context.GetRouterInfo().GetAddresses();
if (!a) return;
for (const auto& address : *a)
{
if (!address->host.is_v6 () && address->port)
TryPortMapping (address);
@ -210,8 +211,9 @@ namespace transport @@ -210,8 +211,9 @@ namespace transport
void UPnP::CloseMapping ()
{
const auto& a = context.GetRouterInfo().GetAddresses();
for (const auto& address : a)
const a = context.GetRouterInfo().GetAddresses();
if (!a) return;
for (const auto& address : *a)
{
if (!address->host.is_v6 () && address->port)
CloseMapping (address);

Loading…
Cancel
Save