@ -89,13 +89,13 @@ namespace transport
{
{
if ( m_externalIPAddress [ 0 ] )
if ( m_externalIPAddress [ 0 ] )
{
{
LogPrint ( eLogInfo , " UPnP: ExternalIPAddress = " , m_externalIPAddress ) ;
LogPrint ( eLogDebug , " UPnP: ExternalIPAddress is " , m_externalIPAddress ) ;
i2p : : context . UpdateAddress ( boost : : asio : : ip : : address : : from_string ( m_externalIPAddress ) ) ;
i2p : : context . UpdateAddress ( boost : : asio : : ip : : address : : from_string ( m_externalIPAddress ) ) ;
return ;
return ;
}
}
else
else
{
{
LogPrint ( eLogError , " UPnP: GetExternalIPAddress failed. " ) ;
LogPrint ( eLogError , " UPnP: GetExternalIPAddress() failed. " ) ;
return ;
return ;
}
}
}
}
@ -121,12 +121,12 @@ namespace transport
r = UPNP_AddPortMapping ( m_upnpUrls . controlURL , m_upnpData . first . servicetype , strPort . c_str ( ) , strPort . c_str ( ) , m_NetworkAddr , strDesc . c_str ( ) , strType . c_str ( ) , 0 , " 0 " ) ;
r = UPNP_AddPortMapping ( m_upnpUrls . controlURL , m_upnpData . first . servicetype , strPort . c_str ( ) , strPort . c_str ( ) , m_NetworkAddr , strDesc . c_str ( ) , strType . c_str ( ) , 0 , " 0 " ) ;
if ( r ! = UPNPCOMMAND_SUCCESS )
if ( r ! = UPNPCOMMAND_SUCCESS )
{
{
LogPrint ( eLogError , " UPnP: AddPortMapping ( " , strPort . c_str ( ) , " , " , strPort . c_str ( ) , " , " , m_NetworkAddr , " ) failed with code " , r ) ;
LogPrint ( eLogError , " UPnP: AddPortMapping ( " , m_NetworkAddr , " : " , strPort , " ) failed with code " , r ) ;
return ;
return ;
}
}
else
else
{
{
LogPrint ( eLogDebug , " UPnP: Port Mapping successful. ( " , m_NetworkAddr , " : " , strPort . c_str ( ) , " type " , strType . c_str ( ) , " -> " , m_externalIPAddress , " : " , strPort . c_str ( ) , " ) " ) ;
LogPrint ( eLogDebug , " UPnP: Port Mapping successful. ( " , m_NetworkAddr , " : " , strPort , " type " , strType , " -> " , m_externalIPAddress , " : " , strPort , " ) " ) ;
return ;
return ;
}
}
std : : this_thread : : sleep_for ( std : : chrono : : minutes ( 20 ) ) ; // c++11
std : : this_thread : : sleep_for ( std : : chrono : : minutes ( 20 ) ) ; // c++11
@ -156,7 +156,7 @@ namespace transport
}
}
int r = 0 ;
int r = 0 ;
r = UPNP_DeletePortMapping ( m_upnpUrls . controlURL , m_upnpData . first . servicetype , strPort . c_str ( ) , strType . c_str ( ) , 0 ) ;
r = UPNP_DeletePortMapping ( m_upnpUrls . controlURL , m_upnpData . first . servicetype , strPort . c_str ( ) , strType . c_str ( ) , 0 ) ;
LogPrint ( eLogError , " UPnP: DeletePortMapping() returned : " , r , " \n " ) ;
LogPrint ( eLogError , " UPnP: DeletePortMapping() returned : " , r ) ;
}
}
void UPnP : : Close ( )
void UPnP : : Close ( )