aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-07-06 18:20:17 +0200
committerRiccardo Spagni <ric@spagni.net>2016-07-06 18:20:17 +0200
commit18fa01c0920123a7727ab3fb6aabab165e59002a (patch)
tree31183032405da4f84c10d1378c07403a519b35e9 /contrib
parentMerge pull request #883 (diff)
parentallow peers without port (diff)
downloadmonero-18fa01c0920123a7727ab3fb6aabab165e59002a.tar.xz
Merge pull request #884
c2ad9ca allow peers without port (moneromooo-monero)
Diffstat (limited to 'contrib')
-rw-r--r--contrib/epee/include/string_tools.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h
index b973c6d48..b3623298c 100644
--- a/contrib/epee/include/string_tools.h
+++ b/contrib/epee/include/string_tools.h
@@ -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;
}