Commit Graph

480 Commits (ebd2142114a46d10ad002223fac4c491f008fce0)

Author SHA1 Message Date
Jason Rhinelander ebd2142114 Don't use std::optional::value() because f u macos
This replaces all use of std::optional's `opt.value()` with `*opt`
because macOS is great and the ghost of Steve Jobs says that actually
supporting std::optional's value() method is not for chumps before macOS
10.14.  So don't use it because Apple is great.

Pretty much all of our use of it actually is done better with operator*
anyway (since operator* doesn't do a check that the optional has a
value).

Also replaced *most* of the `has_value()` calls with direct bool
context, except for one in the config section which looked really
confusing at a glance without a has_value().
4 years ago
Jason Rhinelander 26ecf23ad8 Silence various warnings 4 years ago
Stephen Shelton ed31cdaacf
Cosmetic fixes 4 years ago
Stephen Shelton 5f0cbb4625
Don't forget to load your keys 4 years ago
Stephen Shelton 9ba0f117c7
Revert to previous "if hops > 0" logic in Configure() 4 years ago
Stephen Shelton 960dc37c1f
Refactor TunEndpoint::Configure() (partially) 4 years ago
Stephen Shelton f2a26adcaa
Move all [endpoint] options to [network] 4 years ago
Stephen Shelton dd9ab0f1d5
Remove ability to have multiple endpoints/snodes from config 4 years ago
Stephen Shelton b7451b7632
Rip out tag, prefetch tags/addrs from Endpoint 4 years ago
Stephen Shelton df01770466
Rename SnappConfig -> EndpointConfig 4 years ago
Stephen Shelton 93b35c92a7
Eradicate service::Config 4 years ago
Jason Rhinelander 1697bf90fe C++17
Compiles with C++17, replaces ghc::filesystem with std::filesystem,
nonstd::optional with std::optional, and llarp::string_view with
std::string_view.
4 years ago
Jason Rhinelander 3c6aa002b8 Fix errors and warnings compiling on mac 4 years ago
Stephen Shelton 273270916e
The Great Wall of Blame
This commit reflects changes to clang-format rules. Unfortunately,
these rule changes create a massive change to the codebase, which
causes an apparent rewrite of git history.

Git blame's --ignore-rev flag can be used to ignore this commit when
attempting to `git blame` some code.
4 years ago
Jeff d3091cf9fc
Merge pull request #1167 from tewinget/tooling
RouterHive initial PR
4 years ago
Stephen Shelton ea835405c5
Refactor NotifyRouterEvent() to forward args, event code cleanup
This template-ifies Router::NotifyRouterEvent() up so that it accepts
the arguments to instantiate the specified event type, forwarding them
to std::make_unique. This would allow (in the future) the function to
no-op the call and avoid memory allocation. It also slightly reduces
the amount of code required to fire an event.

This commit also simplifies some of the RouterEvent code to reduce
redundancy.
4 years ago
Stephen Shelton 6664202868
Add FindRouterSentEvent and FindRouterReceivedEvent to RouterHive 4 years ago
Jeff f3d23d6fb6
strip rr from dns reply for .snode and .loki (#1172)
fix dns replies so that extra RR for edns are not included.
4 years ago
Thomas Winget 84a1d7dbcc clang format....... 4 years ago
Thomas Winget 695784b2b6 more hive things
DHT PubIntroSentEvent
some helper functions added to RouterHive (C++ class) as well as RouterHive(Python class)
hive.py main() continues to be a testbed for new event types
some more internal classes in pybind
4 years ago
Jason Rhinelander c87fd66386 Fix lookup filter to filter second, not first, lookup 4 years ago
Jeff Becker 877443d95c more introspection code 4 years ago
Jeff Becker d4ccf895e3
Merge branch 'fix-up-introset-lookup-fails-2020-03-02' of ssh://github.com/majestrate/loki-network into fix-up-introset-lookup-fails-2020-03-02 4 years ago
Jeff Becker 79746e3719
remote lookup limiting of 500ms per address 4 years ago
Stephen Shelton 9be8050854
Make format 4 years ago
Stephen Shelton 886a981997
Consolidate introset publishing constants 4 years ago
Jeff Becker a09bb89d15
dont put multiple outbound contexts 4 years ago
Jeff Becker 158a9018f3
rename variable 4 years ago
Jeff Becker 9ff31f6402
spelling is hard 4 years ago
Jeff Becker 8f4362f092
fix up introset lookups 4 years ago
Jason Rhinelander 806d43c34e
Merge pull request #1147 from notlesh/diagnose-pubintro-round2-2020-02-28
Diagnose pubintro round2
4 years ago
Jason Rhinelander b60adc909d Make IntroSet publish confirmed less verbose
Essentially just rate limit the confirmation message to one message per
second.
4 years ago
Jason Rhinelander cfee824a79 Don't republish when we have extra paths
This caused some unwanted behaviour:

- on initial startup we often get two publishes in quick succession
because we're publishing and building paths at the same time

- at the 10m mark we enter a publish loop every 5 seconds because we
have paths with lifetimes < 10min that was triggering this condition,
and yet those paths will never actually be included in the introset
because they are expiring in <10m.
4 years ago
Jason Rhinelander 823c17206f Add min intro set paths, slightly increase spread speed
This should ensure that we have enough shortly after startup for initial
path builds.

The spread speed here gets slightly increased to lifetime/5 (=4min)
instead of lifetime/4 (=5min) so that our "normal" number of paths is 5
with occassional momentary drops to 4, but should always keep us >= the
new minimum of 4.

Because the path spread happens over time, this shouldn't result in a
rebuild of several paths: we'll build 4 quickly, then another at +4m,
another at +8m, etc.  When the initial 4 expire, we'll be dropping from
9 to 5 established but that's still above the minimum (4) so we won't
need to reconnect to several at once, and the spread builds should keep
us at 5 all the time.
4 years ago
Jason Rhinelander 27b8743107 Add warns for introset publish failures 4 years ago
Stephen Shelton 62014de91c
Handle PubIntro relayOrder logic on client-side 4 years ago
Stephen Shelton 61d19179f7
Remove dead code 4 years ago
Jeff Becker ce335dc47d
remove convotags on dead outbound context 4 years ago
Jeff 19a751c41b
Merge pull request #1127 from notlesh/spread-snapp-path-builds-evenly-2020-02-24
Spread snapp path builds evenly
4 years ago
Jeff 4f29405e9e
Merge pull request #1115 from majestrate/handle-multiple-responses-per-lookup-2020-02-20
handle multiple responses per hidden service lookup
4 years ago
Stephen Shelton abe4015986
Use constants for path build timing 4 years ago
Stephen Shelton 230037b9f3
Increase default path timeout from 10min to 20min 4 years ago
Stephen Shelton f0374eb2b7
Use existing 'lastBuild' var for spacing path builds 4 years ago
Stephen Shelton c2c010dbad
Make format 4 years ago
Stephen Shelton c1b5e453c7
Big I, little i, what begins with I? 4 years ago
Stephen Shelton 1db6c6ae3b
Make format 4 years ago
Stephen Shelton c2f719c996
Build endpoint paths at even[ish] intervals 4 years ago
Jeff Becker d2d109e92c
llarp_time_t is now using std::chrono 4 years ago
Jason Rhinelander 089056ca5b Remove all ABSL_ATTRIBUTE_UNUSED uses 4 years ago
Jason Rhinelander b4440094b0 De-abseil, part 2: mutex, locks, (most) time
- util::Mutex is now a std::shared_timed_mutex, which is capable of
  exclusive and shared locks.

- util::Lock is still present as a std::lock_guard<util::Mutex>.

- the locking annotations are preserved, but updated to the latest
  supported by clang rather than using abseil's older/deprecated ones.

- ACQUIRE_LOCK macro is gone since we don't pass mutexes by pointer into
  locks anymore (WTF abseil).

- ReleasableLock is gone.  Instead there are now some llarp::util helper
  methods to obtain unique and/or shared locks:
    - `auto lock = util::unique_lock(mutex);` gets an RAII-but-also
      unlockable object (std::unique_lock<T>, with T inferred from
      `mutex`).
    - `auto lock = util::shared_lock(mutex);` gets an RAII shared (i.e.
      "reader") lock of the mutex.
    - `auto lock = util::unique_locks(mutex1, mutex2, mutex3);` can be
      used to atomically lock multiple mutexes at once (returning a
      tuple of the locks).
  This are templated on the mutex which makes them a bit more flexible
  than using a concrete type: they can be used for any type of lockable
  mutex, not only util::Mutex.  (Some of the code here uses them for
  getting locks around a std::mutex).  Until C++17, using the RAII types
  is painfully verbose:

  ```C++
  // pre-C++17 - needing to figure out the mutex type here is annoying:
  std::unique_lock<util::Mutex> lock(mutex);
  // pre-C++17 and even more verbose (but at least the type isn't needed):
  std::unique_lock<decltype(mutex)> lock(mutex);
  // our compromise:
  auto lock = util::unique_lock(mutex);
  // C++17:
  std::unique_lock lock(mutex);
  ```

  All of these functions will also warn (under gcc or clang) if you
  discard the return value.  You can also do fancy things like
  `auto l = util::unique_lock(mutex, std::adopt_lock)` (which lets a
  lock take over an already-locked mutex).

- metrics code is gone, which also removes a big pile of code that was
  only used by metrics:
  - llarp::util::Scheduler
  - llarp:🧵:TimerQueue
  - llarp::util::Stopwatch
4 years ago