fix up some retarded bullshit

* llarp::service::NameIsValid was not checking that the tld was .loki, add this check.
* make link layer initial connection timeout 5s not the session activity timeout which happens to be 60 god damn seconds.
pull/1576/head
Jeff Becker 3 years ago
parent 0046de3e7a
commit e005b34169
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -7,3 +7,4 @@
constexpr size_t MAX_LINK_MSG_SIZE = 8192;
static constexpr auto DefaultLinkSessionLifetime = 1min;
constexpr size_t MaxSendQueueSize = 1024;
static constexpr auto LinkLayerConnectTimeout = 5s;

@ -331,7 +331,7 @@ namespace llarp
{
return now > m_LastRX && now - m_LastRX > SessionAliveTimeout;
}
return now - m_CreatedAt > SessionAliveTimeout;
return now - m_CreatedAt >= LinkLayerConnectTimeout;
}
bool

@ -819,6 +819,11 @@ namespace llarp
std::string name,
std::function<void(std::optional<std::variant<Address, RouterID>>)> handler)
{
if (not NameIsValid(name))
{
handler(std::nullopt);
return;
}
auto& cache = m_state->nameCache;
const auto maybe = cache.Get(name);
if (maybe.has_value())

@ -19,6 +19,9 @@ namespace llarp::service
bool
NameIsValid(std::string_view lnsName)
{
// make sure it ends with .loki because no fucking shit right?
if (not ends_with(lnsName, ".loki"))
return false;
// strip off .loki suffix
lnsName = lnsName.substr(0, lnsName.find_last_of('.'));

Loading…
Cancel
Save