mirror of https://github.com/oxen-io/lokinet
Cleanup: avoid pointless copy of `this` pointer
This commit is contained in:
parent
9844d358e6
commit
f9395cd5dd
|
@ -153,18 +153,18 @@ struct lokinet_srv_lookup_private
|
|||
auto lock = ctx->acquire();
|
||||
if (ctx->impl and ctx->impl->IsUp())
|
||||
{
|
||||
ctx->impl->CallSafe([host, service, &promise, ctx, self = this]() {
|
||||
ctx->impl->CallSafe([host, service, &promise, ctx, this]() {
|
||||
auto ep = ctx->endpoint();
|
||||
if (ep == nullptr)
|
||||
{
|
||||
promise.set_value(ENOTSUP);
|
||||
return;
|
||||
}
|
||||
ep->LookupServiceAsync(host, service, [self, &promise, host](auto results) {
|
||||
ep->LookupServiceAsync(host, service, [this, &promise, host](auto results) {
|
||||
for (const auto& result : results)
|
||||
{
|
||||
if (auto maybe = SRVFromData(result, host))
|
||||
self->results.emplace_back(*maybe);
|
||||
this->results.emplace_back(*maybe);
|
||||
}
|
||||
promise.set_value(0);
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace llarp
|
|||
Clear();
|
||||
size_t idx = 0;
|
||||
if (not bencode_read_list(
|
||||
[self = this, &idx](llarp_buffer_t* buffer, bool has) {
|
||||
[this, &idx](llarp_buffer_t* buffer, bool has) {
|
||||
if (has)
|
||||
{
|
||||
uint64_t i;
|
||||
|
@ -65,14 +65,14 @@ namespace llarp
|
|||
uint64_t val = -1;
|
||||
if (not bencode_read_integer(buffer, &val))
|
||||
return false;
|
||||
self->m_ProtoVersion = val;
|
||||
m_ProtoVersion = val;
|
||||
}
|
||||
else if (bencode_read_integer(buffer, &i))
|
||||
{
|
||||
// prevent overflow (note that idx includes version too)
|
||||
if (idx > self->m_Version.max_size())
|
||||
if (idx > m_Version.max_size())
|
||||
return false;
|
||||
self->m_Version[idx - 1] = i;
|
||||
m_Version[idx - 1] = i;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
|
|
@ -1877,15 +1877,14 @@ namespace llarp
|
|||
f.S = m->seqno;
|
||||
f.F = p->intro.pathID;
|
||||
transfer->P = replyIntro.pathID;
|
||||
auto self = this;
|
||||
Router()->QueueWork([transfer, p, m, K, self]() {
|
||||
if (not transfer->T.EncryptAndSign(*m, K, self->m_Identity))
|
||||
Router()->QueueWork([transfer, p, m, K, this]() {
|
||||
if (not transfer->T.EncryptAndSign(*m, K, m_Identity))
|
||||
{
|
||||
LogError("failed to encrypt and sign for sessionn T=", transfer->T.T);
|
||||
return;
|
||||
}
|
||||
self->m_SendQueue.tryPushBack(SendEvent_t{transfer, p});
|
||||
self->Router()->TriggerPump();
|
||||
m_SendQueue.tryPushBack(SendEvent_t{transfer, p});
|
||||
Router()->TriggerPump();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
@ -1927,10 +1926,10 @@ namespace llarp
|
|||
traffic[remote].emplace_back(data, t);
|
||||
EnsurePathToService(
|
||||
remote,
|
||||
[self = this](Address addr, OutboundContext* ctx) {
|
||||
[this](Address addr, OutboundContext* ctx) {
|
||||
if (ctx)
|
||||
{
|
||||
for (auto& pending : self->m_state->m_PendingTraffic[addr])
|
||||
for (auto& pending : m_state->m_PendingTraffic[addr])
|
||||
{
|
||||
ctx->AsyncEncryptAndSendTo(pending.Buffer(), pending.protocol);
|
||||
}
|
||||
|
@ -1939,7 +1938,7 @@ namespace llarp
|
|||
{
|
||||
LogWarn("no path made to ", addr);
|
||||
}
|
||||
self->m_state->m_PendingTraffic.erase(addr);
|
||||
m_state->m_PendingTraffic.erase(addr);
|
||||
},
|
||||
PathAlignmentTimeout());
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue