allow peers without port

The default port is then used
This commit is contained in:
moneromooo-monero 2016-07-03 12:51:12 +01:00
parent de91bb75a1
commit c2ad9caf01
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 14 additions and 4 deletions

View file

@ -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;
}