Merge remote-tracking branch 'purple/openssl'

This commit is contained in:
Jeff Becker 2016-11-15 15:12:09 -05:00
commit 644c0e3d33
4 changed files with 29 additions and 15 deletions

View File

@ -52,7 +52,7 @@ namespace client
if (httpProxyKeys.length () > 0) if (httpProxyKeys.length () > 0)
{ {
i2p::data::PrivateKeys keys; i2p::data::PrivateKeys keys;
if(LoadPrivateKeys (keys, httpProxyKeys)) if(LoadPrivateKeys (keys, httpProxyKeys, i2p::data::SIGNING_KEY_TYPE_DSA_SHA1))
{ {
std::map<std::string, std::string> params; std::map<std::string, std::string> params;
ReadI2CPOptionsFromConfig ("httpproxy.", params); ReadI2CPOptionsFromConfig ("httpproxy.", params);
@ -82,7 +82,7 @@ namespace client
if (socksProxyKeys.length () > 0) if (socksProxyKeys.length () > 0)
{ {
i2p::data::PrivateKeys keys; i2p::data::PrivateKeys keys;
if (LoadPrivateKeys (keys, socksProxyKeys)) if (LoadPrivateKeys (keys, socksProxyKeys, i2p::data::SIGNING_KEY_TYPE_DSA_SHA1))
{ {
std::map<std::string, std::string> params; std::map<std::string, std::string> params;
ReadI2CPOptionsFromConfig ("socksproxy.", params); ReadI2CPOptionsFromConfig ("socksproxy.", params);

View File

@ -188,23 +188,34 @@ namespace data
// TODO: check if floodfill has been changed // TODO: check if floodfill has been changed
} }
else else
{
LogPrint (eLogDebug, "NetDb: RouterInfo is older: ", ident.ToBase64()); LogPrint (eLogDebug, "NetDb: RouterInfo is older: ", ident.ToBase64());
updated = false;
}
} }
else else
{ {
r = std::make_shared<RouterInfo> (buf, len); r = std::make_shared<RouterInfo> (buf, len);
if (!r->IsUnreachable ()) if (!r->IsUnreachable ())
{ {
LogPrint (eLogInfo, "NetDb: RouterInfo added: ", ident.ToBase64()); bool inserted = false;
{ {
std::unique_lock<std::mutex> l(m_RouterInfosMutex); std::unique_lock<std::mutex> l(m_RouterInfosMutex);
m_RouterInfos[r->GetIdentHash ()] = r; inserted = m_RouterInfos.insert ({r->GetIdentHash (), r}).second;
} }
if (r->IsFloodfill () && r->IsReachable ()) // floodfill must be reachable if (inserted)
{ {
std::unique_lock<std::mutex> l(m_FloodfillsMutex); LogPrint (eLogInfo, "NetDb: RouterInfo added: ", ident.ToBase64());
m_Floodfills.push_back (r); if (r->IsFloodfill () && r->IsReachable ()) // floodfill must be reachable
{
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
m_Floodfills.push_back (r);
}
}
else
{
LogPrint (eLogWarning, "NetDb: Duplicated RouterInfo ", ident.ToBase64());
updated = false;
} }
} }
else else

View File

@ -260,7 +260,8 @@ namespace transport
{ {
// we send it to ourself // we send it to ourself
for (auto& it: msgs) for (auto& it: msgs)
i2p::HandleI2NPMessage (it); m_LoopbackHandler.PutNextMessage (it);
m_LoopbackHandler.Flush ();
return; return;
} }
if(RoutesRestricted() && ! IsRestrictedPeer(ident)) return; if(RoutesRestricted() && ! IsRestrictedPeer(ident)) return;

View File

@ -160,13 +160,15 @@ namespace transport
uint64_t m_LastInBandwidthUpdateBytes, m_LastOutBandwidthUpdateBytes; uint64_t m_LastInBandwidthUpdateBytes, m_LastOutBandwidthUpdateBytes;
uint64_t m_LastBandwidthUpdateTime; uint64_t m_LastBandwidthUpdateTime;
/** which router families to trust for first hops */ /** which router families to trust for first hops */
std::vector<std::string> m_TrustedFamilies; std::vector<std::string> m_TrustedFamilies;
mutable std::mutex m_FamilyMutex; mutable std::mutex m_FamilyMutex;
/** which routers for first hop to trust */ /** which routers for first hop to trust */
std::vector<i2p::data::IdentHash> m_TrustedRouters; std::vector<i2p::data::IdentHash> m_TrustedRouters;
mutable std::mutex m_TrustedRoutersMutex; mutable std::mutex m_TrustedRoutersMutex;
i2p::I2NPMessagesHandler m_LoopbackHandler;
public: public: