mirror of
https://github.com/monero-project/monero.git
synced 2025-05-06 13:35:04 -04:00
allow peers without port
The default port is then used
This commit is contained in:
parent
de91bb75a1
commit
c2ad9caf01
2 changed files with 14 additions and 4 deletions
|
@ -350,19 +350,24 @@ POP_WARNINGS
|
|||
{
|
||||
//parse ip and address
|
||||
std::string::size_type p = addres.find(':');
|
||||
std::string ip_str, port_str;
|
||||
if(p == std::string::npos)
|
||||
{
|
||||
return false;
|
||||
port = 0;
|
||||
ip_str = addres;
|
||||
}
|
||||
else
|
||||
{
|
||||
ip_str = addres.substr(0, p);
|
||||
port_str = addres.substr(p+1, addres.size());
|
||||
}
|
||||
std::string ip_str = addres.substr(0, p);
|
||||
std::string port_str = addres.substr(p+1, addres.size());
|
||||
|
||||
if(!get_ip_int32_from_string(ip, ip_str))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!get_xtype_from_string(port, port_str))
|
||||
if(p != std::string::npos && !get_xtype_from_string(port, port_str))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue