mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
use shared pointers
This commit is contained in:
parent
f0bc2a3645
commit
1015188c4e
13
Datagram.h
13
Datagram.h
|
@ -48,24 +48,19 @@ namespace datagram
|
|||
uint64_t LastSuccess() const { return m_LastSuccess; }
|
||||
struct Info
|
||||
{
|
||||
const i2p::data::IdentHash * IBGW;
|
||||
const i2p::data::IdentHash * OBEP;
|
||||
std::shared_ptr<const i2p::data::IdentHash> IBGW;
|
||||
std::shared_ptr<const i2p::data::IdentHash> OBEP;
|
||||
const uint64_t activity;
|
||||
const uint64_t success;
|
||||
Info() : IBGW(nullptr), OBEP(nullptr), activity(0), success(0) {}
|
||||
Info(const uint8_t * ibgw, const uint8_t * obep, const uint64_t a, const uint64_t s) :
|
||||
activity(a),
|
||||
success(s) {
|
||||
if(ibgw) IBGW = new i2p::data::IdentHash(ibgw);
|
||||
if(ibgw) IBGW = std::make_shared<i2p::data::IdentHash>(ibgw);
|
||||
else IBGW = nullptr;
|
||||
if(obep) OBEP = new i2p::data::IdentHash(obep);
|
||||
if(obep) OBEP = std::make_shared<i2p::data::IdentHash>(obep);
|
||||
else OBEP = nullptr;
|
||||
}
|
||||
~Info()
|
||||
{
|
||||
if(IBGW) delete IBGW;
|
||||
if(OBEP) delete OBEP;
|
||||
}
|
||||
};
|
||||
|
||||
Info GetSessionInfo() const;
|
||||
|
|
|
@ -346,20 +346,20 @@ namespace http {
|
|||
s << "<th>Idle Time</th>";
|
||||
s << "</th>";
|
||||
auto forward = i2p::client::context.GetForwardInfosFor(dest->GetIdentHash());
|
||||
for (auto & info : forward)
|
||||
for (auto info : forward)
|
||||
{
|
||||
s << "<tr>";
|
||||
s << "<td>" << info.RemoteIdent.ToBase32() << "</td>";
|
||||
s << "<td>";
|
||||
if(info.CurrentIBGW)
|
||||
s << info.CurrentIBGW->ToBase64().c_str();
|
||||
s << std::string(info.CurrentIBGW->ToBase64());
|
||||
else
|
||||
s << "(none)";
|
||||
s << "</td>";
|
||||
|
||||
s << "<td>";
|
||||
if(info.CurrentOBEP)
|
||||
s << info.CurrentOBEP->ToBase64().c_str();
|
||||
s << std::string(info.CurrentOBEP->ToBase64());
|
||||
else
|
||||
s << "(none)";
|
||||
s << "</td>";
|
||||
|
|
|
@ -148,9 +148,9 @@ namespace client
|
|||
/** ident hash of remote destination */
|
||||
const i2p::data::IdentHash RemoteIdent;
|
||||
/** ident hash of IBGW in use currently in this session or nullptr if none is set */
|
||||
const i2p::data::IdentHash * CurrentIBGW;
|
||||
std::shared_ptr<const i2p::data::IdentHash> CurrentIBGW;
|
||||
/** ident hash of OBEP in use for this session or nullptr if none is set */
|
||||
const i2p::data::IdentHash * CurrentOBEP;
|
||||
std::shared_ptr<const i2p::data::IdentHash> CurrentOBEP;
|
||||
/** i2p router's udp endpoint */
|
||||
const boost::asio::ip::udp::endpoint LocalEndpoint;
|
||||
/** client's udp endpoint */
|
||||
|
|
Loading…
Reference in a new issue