Пример #1
0
 void UPnP::Run ()
 {
     for (auto& address : context.GetRouterInfo ().GetAddresses ())
     {
         if (!address.host.is_v6 ())
         {
             Discover ();
             if (address.transportStyle == data::RouterInfo::eTransportSSU )
             {
                 TryPortMapping (I2P_UPNP_UDP, address.port);
             }
             else if (address.transportStyle == data::RouterInfo::eTransportNTCP )
             {
                 TryPortMapping (I2P_UPNP_TCP, address.port);
             }
         }
     }
 } 
Пример #2
0
Файл: UPnP.cpp Проект: D504/i2pd
 void UPnP::Run ()
 {
     const std::vector<std::shared_ptr<i2p::data::RouterInfo::Address> > a = context.GetRouterInfo().GetAddresses();
     for (auto address : a)
     {
         if (!address->host.is_v6 ())
         {
             Discover ();
             if (address->transportStyle == data::RouterInfo::eTransportSSU )
             {
                 TryPortMapping (I2P_UPNP_UDP, address->port);
             }
             else if (address->transportStyle == data::RouterInfo::eTransportNTCP )
             {
                 TryPortMapping (I2P_UPNP_TCP, address->port);
             }
         }
     }
 } 
Пример #3
0
	void UPnP::PortMapping ()
	{
		const auto& a = context.GetRouterInfo().GetAddresses();
		for (const auto& address : a)
        {
            if (!address->host.is_v6 ())
            	TryPortMapping (address);
        }
		m_Timer.expires_from_now (boost::posix_time::minutes(20));	// every 20 minutes
		m_Timer.async_wait ([this](const boost::system::error_code& ecode)
			{ 
				if (ecode != boost::asio::error::operation_aborted)	
					PortMapping ();
			});

	}