Sanity checks around shared_from_this()

pull/1295/head
Stephen Shelton 4 years ago
parent 45cda241f0
commit 91a2af0eda
No known key found for this signature in database
GPG Key ID: EE4BADACCE8B631C

@ -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); });

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

@ -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*){};

Loading…
Cancel
Save