Browse Source

Merge remote-tracking branch 'purple/openssl' into low-latency-merge

pull/709/head
Jeff Becker 8 years ago
parent
commit
673a2acade
  1. 4
      ClientContext.cpp
  2. 23
      NetDb.cpp
  3. 3
      Transports.cpp
  4. 14
      Transports.h

4
ClientContext.cpp

@ -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);

23
NetDb.cpp

@ -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)
{
LogPrint (eLogInfo, "NetDb: RouterInfo added: ", ident.ToBase64());
if (r->IsFloodfill () && r->IsReachable ()) // floodfill must be reachable
{
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
m_Floodfills.push_back (r);
}
}
else
{ {
std::unique_lock<std::mutex> l(m_FloodfillsMutex); LogPrint (eLogWarning, "NetDb: Duplicated RouterInfo ", ident.ToBase64());
m_Floodfills.push_back (r); updated = false;
} }
} }
else else

3
Transports.cpp

@ -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;

14
Transports.h

@ -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:

Loading…
Cancel
Save