From b8a205f755906666ecc2129e50d2d07a1bb1761e Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Thu, 30 Jun 2016 13:25:20 -0400 Subject: [PATCH] netdb.cpp: * explicitly define replyIdent Daemon.cpp: * wait for 1 second before checking if transports are bound to wait for transports to bind --- Daemon.cpp | 1 + NetDb.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Daemon.cpp b/Daemon.cpp index a3b8ee09..86e11ff9 100644 --- a/Daemon.cpp +++ b/Daemon.cpp @@ -257,6 +257,7 @@ namespace i2p bool ssu; i2p::config::GetOption("ssu", ssu); LogPrint(eLogInfo, "Daemon: starting Transports"); i2p::transport::transports.Start(ntcp, ssu); + std::this_thread::sleep_for(std::chrono::seconds(1)); if (i2p::transport::transports.IsBoundNTCP() || i2p::transport::transports.IsBoundSSU()) { LogPrint(eLogInfo, "Daemon: Transports started"); } else { diff --git a/NetDb.cpp b/NetDb.cpp index c7c54176..def8086e 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -617,6 +617,9 @@ namespace data int l = i2p::data::ByteStreamToBase64 (buf, 32, key, 48); key[l] = 0; uint8_t flag = buf[64]; + + IdentHash replyIdent(buf + 32); + LogPrint (eLogDebug, "NetDb: DatabaseLookup for ", key, " recieved flags=", (int)flag); uint8_t lookupType = flag & DATABASE_LOOKUP_TYPE_FLAGS_MASK; const uint8_t * excluded = buf + 65; @@ -739,12 +742,12 @@ namespace data auto exploratoryPool = i2p::tunnel::tunnels.GetExploratoryPool (); auto outbound = exploratoryPool ? exploratoryPool->GetNextOutboundTunnel () : nullptr; if (outbound) - outbound->SendTunnelDataMsg (buf+32, replyTunnelID, replyMsg); + outbound->SendTunnelDataMsg (replyIdent, replyTunnelID, replyMsg); else - transports.SendMessage (buf+32, i2p::CreateTunnelGatewayMsg (replyTunnelID, replyMsg)); + transports.SendMessage (replyIdent, i2p::CreateTunnelGatewayMsg (replyTunnelID, replyMsg)); } else - transports.SendMessage (buf+32, replyMsg); + transports.SendMessage (replyIdent, replyMsg); } }