1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

Sanity checks around shared_from_this()

This commit is contained in:
Stephen Shelton 2020-06-01 14:56:58 -06:00
parent 45cda241f0
commit 91a2af0eda
No known key found for this signature in database
GPG key ID: EE4BADACCE8B631C
3 changed files with 2 additions and 11 deletions

View file

@ -90,6 +90,7 @@ namespace llarp
m_RemoteRC = msg->rc;
GotLIM = util::memFn(&Session::GotRenegLIM, this);
auto self = shared_from_this();
assert(self.use_count() > 1);
SendOurLIM([self](ILinkSession::DeliveryStatus st) {
if (st == ILinkSession::DeliveryStatus::eDeliverySuccess)
{
@ -241,6 +242,7 @@ namespace llarp
}
}
auto self = shared_from_this();
assert(self.use_count() > 1);
if (m_EncryptNext && !m_EncryptNext->empty())
{
m_Parent->QueueWork([self, data = std::move(m_EncryptNext)] { self->EncryptWorker(data); });

View file

@ -47,12 +47,6 @@ namespace llarp
~Session() = default;
std::shared_ptr<ILinkSession>
BorrowSelf() override
{
return shared_from_this();
}
void
Pump() override;

View file

@ -26,11 +26,6 @@ namespace llarp
eDeliveryDropped = 1
};
/// equiv of shared_from_this but for the interface type so
/// that each implementation can use shared_from_this
virtual std::shared_ptr<ILinkSession>
BorrowSelf() = 0;
/// hook for utp for when we have established a connection
virtual void
OnLinkEstablished(ILinkLayer*){};