@ -470,7 +470,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
Ticks < HoursDouble > ( pszDest ? 0 h : Now < NodeSeconds > ( ) - addrConnect . nTime ) ) ;
Ticks < HoursDouble > ( pszDest ? 0 h : Now < NodeSeconds > ( ) - addrConnect . nTime ) ) ;
// Resolve
// Resolve
const uint16_t default_port { pszDest ! = nullptr ? m_params. GetDefaultPort( pszDest ) :
const uint16_t default_port { pszDest ! = nullptr ? GetDefaultPort( pszDest ) :
m_params . GetDefaultPort ( ) } ;
m_params . GetDefaultPort ( ) } ;
if ( pszDest ) {
if ( pszDest ) {
const std : : vector < CService > resolved { Lookup ( pszDest , default_port , fNameLookup & & ! HaveNameProxy ( ) , 256 ) } ;
const std : : vector < CService > resolved { Lookup ( pszDest , default_port , fNameLookup & & ! HaveNameProxy ( ) , 256 ) } ;
@ -2769,7 +2769,7 @@ std::vector<AddedNodeInfo> CConnman::GetAddedNodeInfo() const
}
}
for ( const std : : string & strAddNode : lAddresses ) {
for ( const std : : string & strAddNode : lAddresses ) {
CService service ( LookupNumeric ( strAddNode , m_params. GetDefaultPort( strAddNode ) ) ) ;
CService service ( LookupNumeric ( strAddNode , GetDefaultPort( strAddNode ) ) ) ;
AddedNodeInfo addedNode { strAddNode , CService ( ) , false , false } ;
AddedNodeInfo addedNode { strAddNode , CService ( ) , false , false } ;
if ( service . IsValid ( ) ) {
if ( service . IsValid ( ) ) {
// strAddNode is an IP:port
// strAddNode is an IP:port
@ -3094,6 +3094,16 @@ NodeId CConnman::GetNewNodeId()
return nLastNodeId . fetch_add ( 1 , std : : memory_order_relaxed ) ;
return nLastNodeId . fetch_add ( 1 , std : : memory_order_relaxed ) ;
}
}
uint16_t CConnman : : GetDefaultPort ( Network net ) const
{
return net = = NET_I2P ? I2P_SAM31_PORT : m_params . GetDefaultPort ( ) ;
}
uint16_t CConnman : : GetDefaultPort ( const std : : string & addr ) const
{
CNetAddr a ;
return a . SetSpecial ( addr ) ? GetDefaultPort ( a . GetNetwork ( ) ) : m_params . GetDefaultPort ( ) ;
}
bool CConnman : : Bind ( const CService & addr_ , unsigned int flags , NetPermissionFlags permissions )
bool CConnman : : Bind ( const CService & addr_ , unsigned int flags , NetPermissionFlags permissions )
{
{