| 216 | } |
| 217 | |
| 218 | void ClientContext::ReloadConfig () |
| 219 | { |
| 220 | // TODO: handle config changes |
| 221 | /*std::string config; i2p::config::GetOption("conf", config); |
| 222 | i2p::config::ParseConfig(config);*/ |
| 223 | |
| 224 | // change shared local destination |
| 225 | m_SharedLocalDestination->Release (); |
| 226 | CreateNewSharedLocalDestination (); |
| 227 | |
| 228 | // recreate HTTP proxy |
| 229 | if (m_HttpProxy) |
| 230 | { |
| 231 | m_HttpProxy->Stop (); |
| 232 | delete m_HttpProxy; |
| 233 | m_HttpProxy = nullptr; |
| 234 | } |
| 235 | ReadHttpProxy (); |
| 236 | |
| 237 | // recreate SOCKS proxy |
| 238 | if (m_SocksProxy) |
| 239 | { |
| 240 | m_SocksProxy->Stop (); |
| 241 | delete m_SocksProxy; |
| 242 | m_SocksProxy = nullptr; |
| 243 | } |
| 244 | ReadSocksProxy (); |
| 245 | |
| 246 | // handle tunnels |
| 247 | // reset isUpdated for each tunnel |
| 248 | VisitTunnels (false); |
| 249 | // reload tunnels |
| 250 | ReadTunnels(); |
| 251 | // delete not updated tunnels (not in config anymore) |
| 252 | VisitTunnels (true); |
| 253 | |
| 254 | // delete unused destinations |
| 255 | std::unique_lock<std::mutex> l(m_DestinationsMutex); |
| 256 | for (auto it = m_Destinations.begin (); it != m_Destinations.end ();) |
| 257 | { |
| 258 | auto dest = it->second; |
| 259 | if (dest->GetRefCounter () > 0) ++it; // skip |
| 260 | else |
| 261 | { |
| 262 | dest->Stop (); |
| 263 | it = m_Destinations.erase (it); |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | bool ClientContext::LoadPrivateKeys (i2p::data::PrivateKeys& keys, std::string_view filename, |
| 269 | i2p::data::SigningKeyType sigType, i2p::data::CryptoKeyType cryptoType) |
no test coverage detected