mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
configure persist of peer profiles
* If persist.profiles = false, peer profiles not stored on disk * remove inet_pton for windows * update configs
This commit is contained in:
parent
ca671551c8
commit
79c0c11e80
|
@ -37,7 +37,12 @@ port = 7070
|
|||
enabled = true
|
||||
address = 127.0.0.1
|
||||
port = 4444
|
||||
# keys = http-proxy-keys.dat
|
||||
inbound.length = 1
|
||||
inbound.quantity = 5
|
||||
outbound.length = 1
|
||||
outbound.quantity = 5
|
||||
signaturetype=7
|
||||
keys = proxy-keys.dat
|
||||
# addresshelper = true
|
||||
# outproxy = http://false.i2p
|
||||
## httpproxy section also accepts I2CP parameters, like "inbound.length" etc.
|
||||
|
@ -46,7 +51,7 @@ port = 4444
|
|||
enabled = true
|
||||
address = 127.0.0.1
|
||||
port = 4447
|
||||
# keys = socks-proxy-keys.dat
|
||||
keys = proxy-keys.dat
|
||||
# outproxy.enabled = false
|
||||
# outproxy = 127.0.0.1
|
||||
# outproxyport = 9050
|
||||
|
@ -80,3 +85,6 @@ verify = true
|
|||
|
||||
[limits]
|
||||
transittunnels = 50
|
||||
|
||||
[persist]
|
||||
profiles = false
|
||||
|
|
|
@ -225,3 +225,7 @@ verify = true
|
|||
# inbound.quantity = 3
|
||||
# outbound.length = 2
|
||||
# outbound.quantity = 3
|
||||
|
||||
[persist]
|
||||
## Save peer profiles on disk (default: true)
|
||||
# profiles = true
|
||||
|
|
|
@ -237,7 +237,7 @@ namespace config {
|
|||
options_description ntcp2("NTCP2 Options");
|
||||
ntcp2.add_options()
|
||||
("ntcp2.enabled", value<bool>()->default_value(true), "Enable NTCP2 (default: enabled)")
|
||||
("ntcp2.published", value<bool>()->default_value(false), "Publish NTCP2 (default: disabled)")
|
||||
("ntcp2.published", value<bool>()->default_value(false), "Publish NTCP2 (default: disabled)")
|
||||
("ntcp2.port", value<uint16_t>()->default_value(0), "Port to listen for incoming NTCP2 connections (default: auto)")
|
||||
;
|
||||
|
||||
|
@ -249,10 +249,15 @@ namespace config {
|
|||
"1.pool.ntp.org,"
|
||||
"2.pool.ntp.org,"
|
||||
"3.pool.ntp.org"
|
||||
), "Comma separated list of NTCP servers")
|
||||
), "Comma separated list of NTCP servers")
|
||||
("nettime.ntpsyncinterval", value<int>()->default_value(72), "NTP sync interval in hours (default: 72)")
|
||||
;
|
||||
|
||||
options_description persist("Network information persisting options");
|
||||
persist.add_options()
|
||||
("persist.profiles", value<bool>()->default_value(true), "Persist peer profiles (default: true)")
|
||||
;
|
||||
|
||||
m_OptionsDesc
|
||||
.add(general)
|
||||
.add(limits)
|
||||
|
@ -272,6 +277,7 @@ namespace config {
|
|||
.add(exploratory)
|
||||
.add(ntcp2)
|
||||
.add(nettime)
|
||||
.add(persist)
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,12 @@ namespace data
|
|||
m_Families.LoadCertificates ();
|
||||
Load ();
|
||||
|
||||
uint16_t threshold; i2p::config::GetOption("reseed.threshold", threshold);
|
||||
uint16_t threshold; i2p::config::GetOption("reseed.threshold", threshold);
|
||||
if (m_RouterInfos.size () < threshold) // reseed if # of router less than threshold
|
||||
Reseed ();
|
||||
|
||||
i2p::config::GetOption("persist.profiles", m_PersistProfiles);
|
||||
|
||||
m_IsRunning = true;
|
||||
m_Thread = new std::thread (std::bind (&NetDb::Run, this));
|
||||
}
|
||||
|
@ -56,8 +58,9 @@ namespace data
|
|||
{
|
||||
if (m_IsRunning)
|
||||
{
|
||||
for (auto& it: m_RouterInfos)
|
||||
it.second->SaveProfile ();
|
||||
if (m_PersistProfiles)
|
||||
for (auto& it: m_RouterInfos)
|
||||
it.second->SaveProfile ();
|
||||
DeleteObsoleteProfiles ();
|
||||
m_RouterInfos.clear ();
|
||||
m_Floodfills.clear ();
|
||||
|
@ -539,7 +542,7 @@ namespace data
|
|||
{
|
||||
if (it->second->IsUnreachable ())
|
||||
{
|
||||
it->second->SaveProfile ();
|
||||
if (m_PersistProfiles) it->second->SaveProfile ();
|
||||
it = m_RouterInfos.erase (it);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -144,6 +144,8 @@ namespace data
|
|||
friend class NetDbRequests;
|
||||
NetDbRequests m_Requests;
|
||||
|
||||
bool m_PersistProfiles;
|
||||
|
||||
/** router info we are bootstrapping from or nullptr if we are not currently doing that*/
|
||||
std::shared_ptr<RouterInfo> m_FloodfillBootstrap;
|
||||
|
||||
|
|
|
@ -817,7 +817,6 @@ namespace transport
|
|||
if (profile)
|
||||
{
|
||||
profile->TunnelNonReplied();
|
||||
profile->Save(it->first);
|
||||
}
|
||||
std::unique_lock<std::mutex> l(m_PeersMutex);
|
||||
it = m_Peers.erase (it);
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
|
||||
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
|
||||
|
||||
/* // No more needed. Exists in MinGW.
|
||||
int inet_pton(int af, const char *src, void *dst)
|
||||
{ /* This function was written by Petar Korponai?. See
|
||||
http://stackoverflow.com/questions/15660203/inet-pton-identifier-not-found */
|
||||
{ // This function was written by Petar Korponai?. See http://stackoverflow.com/questions/15660203/inet-pton-identifier-not-found
|
||||
struct sockaddr_storage ss;
|
||||
int size = sizeof (ss);
|
||||
char src_copy[INET6_ADDRSTRLEN + 1];
|
||||
|
@ -45,7 +45,7 @@ http://stackoverflow.com/questions/15660203/inet-pton-identifier-not-found */
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
#else /* !WIN32 => UNIX */
|
||||
#include <sys/types.h>
|
||||
#include <ifaddrs.h>
|
||||
|
|
Loading…
Reference in a new issue