use shared_ptr

pull/601/head
Jeff Becker 5 years ago
parent 84ce9460f5
commit f832c9a593
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -184,14 +184,15 @@ namespace llarp
HopHandler_ptr
PathContext::GetByUpstream(const RouterID& remote, const PathID_t& id)
{
auto own = MapGet(m_OurPaths, id,
[](const PathSet_ptr) -> bool {
// TODO: is this right?
return true;
},
[remote, id](PathSet_ptr p) -> HopHandler_ptr {
return p->GetByUpstream(remote, id);
});
auto own = MapGet(
m_OurPaths, id,
[](const PathSet_ptr) -> bool {
// TODO: is this right?
return true;
},
[remote, id](PathSet_ptr p) -> HopHandler_ptr {
return p->GetByUpstream(remote, id);
});
if(own)
return own;

@ -1162,18 +1162,18 @@ namespace llarp
}
m_PendingTraffic[remote].emplace_back(data, t);
// no converstation
return EnsurePathToService(remote,
[&](Address r, OutboundContext* c) {
if(c)
{
c->UpdateIntroSet(true);
for(auto& pending : m_PendingTraffic[r])
c->AsyncEncryptAndSendTo(
pending.Buffer(), pending.protocol);
}
m_PendingTraffic.erase(r);
},
5000, true);
return EnsurePathToService(
remote,
[&](Address r, OutboundContext* c) {
if(c)
{
c->UpdateIntroSet(true);
for(auto& pending : m_PendingTraffic[r])
c->AsyncEncryptAndSendTo(pending.Buffer(), pending.protocol);
}
m_PendingTraffic.erase(r);
},
5000, true);
}
void

@ -83,7 +83,6 @@ namespace llarp
{
if(itr->second->IsExpired(now))
{
IBPool.DelPtr(itr->second);
itr = m_RecvMsgs.erase(itr);
}
else
@ -374,8 +373,6 @@ namespace llarp
utp_set_userdata(sock, nullptr);
sock = nullptr;
}
for(auto& item : m_RecvMsgs)
IBPool.DelPtr(item.second);
}
bool
@ -564,7 +561,10 @@ namespace llarp
LogError("inbound buffer mempool full");
return false;
}
m_RecvMsgs.emplace(msgid, IBPool.NewPtr());
m_RecvMsgs.emplace(
msgid, InboundMessage(IBPool.NewPtr(), [](_InboundMessage* m) {
IBPool.DelPtr(m);
}));
}
auto itr = m_RecvMsgs.find(msgid);

Loading…
Cancel
Save