diff --git a/I2NPProtocol.cpp b/I2NPProtocol.cpp index 369ad160..588332a3 100644 --- a/I2NPProtocol.cpp +++ b/I2NPProtocol.cpp @@ -205,10 +205,10 @@ namespace i2p return m; } - I2NPMessage * CreateDatabaseStoreMsg (const i2p::data::RouterInfo * router, uint32_t replyToken) + I2NPMessage * CreateDatabaseStoreMsg (std::shared_ptr router, uint32_t replyToken) { if (!router) // we send own RouterInfo - router = &context.GetRouterInfo (); + router = context.GetSharedRouterInfo (); I2NPMessage * m = NewI2NPShortMessage (); uint8_t * payload = m->GetPayload (); diff --git a/I2NPProtocol.h b/I2NPProtocol.h index 7d4ee4e5..fde33186 100644 --- a/I2NPProtocol.h +++ b/I2NPProtocol.h @@ -209,7 +209,7 @@ namespace tunnel const i2p::tunnel::InboundTunnel * replyTunnel, const uint8_t * replyKey, const uint8_t * replyTag); I2NPMessage * CreateDatabaseSearchReply (const i2p::data::IdentHash& ident, std::vector routers); - I2NPMessage * CreateDatabaseStoreMsg (const i2p::data::RouterInfo * router = nullptr, uint32_t replyToken = 0); + I2NPMessage * CreateDatabaseStoreMsg (std::shared_ptr router = nullptr, uint32_t replyToken = 0); I2NPMessage * CreateDatabaseStoreMsg (std::shared_ptr leaseSet, uint32_t replyToken = 0); bool HandleBuildRequestRecords (int num, uint8_t * records, uint8_t * clearText); diff --git a/NetDb.cpp b/NetDb.cpp index 9a0f1a0f..a79489ab 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -740,7 +740,7 @@ namespace data LogPrint ("Requested RouterInfo ", key, " found"); router->LoadBuffer (); if (router->GetBuffer ()) - replyMsg = CreateDatabaseStoreMsg (router.get ()); + replyMsg = CreateDatabaseStoreMsg (router); } if (!replyMsg) @@ -874,7 +874,7 @@ namespace data { uint32_t replyToken = i2p::context.GetRandomNumberGenerator ().GenerateWord32 (); LogPrint ("Publishing our RouterInfo to ", floodfill->GetIdentHashAbbreviation (), ". reply token=", replyToken); - transports.SendMessage (floodfill->GetIdentHash (), CreateDatabaseStoreMsg ((RouterInfo *)nullptr, replyToken)); + transports.SendMessage (floodfill->GetIdentHash (), CreateDatabaseStoreMsg (std::make_shared(nullptr), replyToken)); excluded.insert (floodfill->GetIdentHash ()); } }