Make tunnels.cfg configurable

This commit is contained in:
Edward Tjörnhammar 2015-08-11 23:19:25 +02:00
parent 14c5753261
commit 3d489a2996
5 changed files with 18 additions and 4 deletions

View file

@ -280,13 +280,14 @@ namespace client
void ClientContext::ReadTunnels ()
{
boost::property_tree::ptree pt;
std::string pathTunnelsConfigFile = i2p::util::filesystem::GetTunnelsConfigFile().string();
try {
boost::property_tree::read_ini(
i2p::util::filesystem::GetFullPath(TUNNELS_CONFIG_FILENAME),
pathTunnelsConfigFile,
pt
);
} catch(const std::exception& ex) {
LogPrint(eLogWarning, "Can't read ", TUNNELS_CONFIG_FILENAME, ": ", ex.what ());
LogPrint(eLogWarning, "Can't read ", pathTunnelsConfigFile, ": ", ex.what ());
return;
}
@ -349,7 +350,7 @@ namespace client
LogPrint (eLogError, "I2P server tunnel for destination ", m_AddressBook.ToAddress(localDestination->GetIdentHash ()), " already exists");
numServerTunnels++;
} else
LogPrint (eLogWarning, "Unknown section type=", type, " of ", name, " in ", TUNNELS_CONFIG_FILENAME);
LogPrint (eLogWarning, "Unknown section type=", type, " of ", name, " in ", pathTunnelsConfigFile);
} catch (const std::exception& ex) {
LogPrint (eLogError, "Can't read tunnel ", name, " params: ", ex.what ());