Merge remote-tracking branch 'origin/master' into debian/sid

This commit is contained in:
Jason Rhinelander 2019-08-29 13:19:25 -03:00
commit 0031315e73
7 changed files with 32 additions and 6 deletions

View File

@ -1,3 +1,6 @@
#include <constants/version.hpp>
const char Version::LLARP_NET_ID[] = "testnet";
#ifndef LLARP_DEFAULT_NETID
#define LLARP_DEFAULT_NETID "testnet"
#endif
const char Version::LLARP_NET_ID[] = LLARP_DEFAULT_NETID;

View File

@ -6,11 +6,11 @@
#endif
#ifndef LLARP_VERSION_MIN
#define LLARP_VERSION_MIN "4"
#define LLARP_VERSION_MIN "5"
#endif
#ifndef LLARP_VERSION_PATCH
#define LLARP_VERSION_PATCH "3"
#define LLARP_VERSION_PATCH "0"
#endif
#ifndef LLARP_VERSION_NUM

View File

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

View File

@ -157,7 +157,12 @@ namespace llarp
else
{
LogInfo("pending session at ", itr->first, " timed out");
itr->second->Close();
// defer call so we can acquire mutexes later
auto self = itr->second->BorrowSelf();
m_Logic->queue_func([&, self]() {
this->HandleTimeout(self.get());
self->Close();
});
itr = m_Pending.erase(itr);
}
}

View File

@ -25,6 +25,11 @@ 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 *){};

View File

@ -15,7 +15,8 @@ namespace llarp
{
struct LinkLayer;
struct Session : public ILinkSession
struct Session : public ILinkSession,
public std::enable_shared_from_this< Session >
{
/// remote router's rc
RouterContact remoteRC;
@ -155,6 +156,12 @@ namespace llarp
void
Pump() override;
std::shared_ptr< ILinkSession >
BorrowSelf() override
{
return shared_from_this();
}
bool
SendKeepAlive() override;

View File

@ -1 +1 @@
just a lot of wind
breaking winds