From 85902b358ac52332dde696c41f46aded8e617ef7 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 26 Jan 2021 13:43:20 -0500 Subject: [PATCH] remove [] from yggdrasil reseed address --- libi2pd/Reseed.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libi2pd/Reseed.cpp b/libi2pd/Reseed.cpp index 80b834e6..33471b10 100644 --- a/libi2pd/Reseed.cpp +++ b/libi2pd/Reseed.cpp @@ -91,7 +91,8 @@ namespace data { LogPrint (eLogInfo, "Reseed: yggdrasil is supported"); std::string yggReseedURLs; i2p::config::GetOption("reseed.yggurls", yggReseedURLs); - boost::split(yggReseedHostList, yggReseedURLs, boost::is_any_of(","), boost::token_compress_on); + if (!yggReseedURLs.empty ()) + boost::split(yggReseedHostList, yggReseedURLs, boost::is_any_of(","), boost::token_compress_on); } if (httpsReseedHostList.empty () && yggReseedHostList.empty()) @@ -744,8 +745,11 @@ namespace data boost::system::error_code ecode; boost::asio::io_service service; boost::asio::ip::tcp::socket s(service, boost::asio::ip::tcp::v6()); - - s.connect (boost::asio::ip::tcp::endpoint (boost::asio::ip::address_v6::from_string (url.host), url.port), ecode); + + if (url.host.length () < 2) return ""; // assume [] + auto host = url.host.substr (1, url.host.length () - 2); + LogPrint (eLogDebug, "Reseed: Connecting to yggdrasil ", url.host, ":", url.port); + s.connect (boost::asio::ip::tcp::endpoint (boost::asio::ip::address_v6::from_string (host), url.port), ecode); if (!ecode) { LogPrint (eLogDebug, "Reseed: Connected to yggdrasil ", url.host, ":", url.port);