Commit Graph

240 Commits (8b321612da4e129b8eee4e02af755184d2405fe9)

Author SHA1 Message Date
Jason Rhinelander 5efcd49a3b Deabseil: remove absl::StrCat, de-templatize fromEnv
fromEnv here wasn't usefully templatized (the base template basically
couldn't be used for anything except a string anyway), so just replaced
it with the overloads we need and moved the implementations out of the
header.
4 years ago
Jason Rhinelander 98c34d995b De-abseil: Add our own llarp::TrimWhiteSpace
Adds a TrimWhiteSpace instead of using abseil's.

Adds Catch2 tests for it, and also converts the existing str tests to
catch (which look much, much nicer than the gtest ones).
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
Jason Rhinelander ac1486d0be Replace absl::optional with optional-lite
Step 1 of removing abseil from lokinet.

For the most part this is a drop-in replacement, but there are also a
few changes here to the JSONRPC layer that were needed to work around
current gcc 10 dev snapshot:

- JSONRPC returns a json now instead of an optional<json>.  It doesn't
  make any sense to have a json rpc call that just closes the connection
  with returning anything.  Invoked functions can return a null (default
  constructed) result now if they don't have anything to return (such a
  null value won't be added as "result").
4 years ago
Jeff Becker 40876a6e3f
configurable log level 4 years ago
Stephen Shelton 1300de2387 Enable the JSON RPC API by default 4 years ago
Jeff Becker e90cb2929e
disable metrics by default 5 years ago
Rick V cf3469e11a
crash on wine, we support linux, ucb_unix, svr4
natively ffs. i tested this patch on wine 4.4 on fuckin
Solaris 11 snv_151
5 years ago
Jeff Becker dd48b149ca
make job queue size configurable 5 years ago
Michael f6adacf936
Review fixes 5 years ago
Michael 3371da98cf
Use libcurl (optional dependency) to hit jsonrpc 5 years ago
Michael 86a07e2a80
Enable more sanitisers 5 years ago
Michael 4d8fe2a8a8
Move meta programming to subdirectory 5 years ago
Michael 1aec0dfa2b
Move logging to subdirectory 5 years ago
Jeff Becker b5402dc6c3
Merge remote-tracking branch 'origin/master' into iwp-redux 5 years ago
Jeff Becker 0241851b72
add likn layer delivery timeout notification for iwp 5 years ago
Michael 70937ab503
Fix docker-compose isolated network 5 years ago
Jeff Becker 94f8531776
more fixups 5 years ago
Jeff Becker 6a48a3b402
code review fixes:
* use std::unordered_set
* use default for ctor/dtor
* don't crash on short packet with nack
5 years ago
Jeff Becker 4ac07ea9fb
use std::make_tuple 5 years ago
Jeff Becker 3c3338e801
Merge remote-tracking branch 'origin/master' into memlink 5 years ago
Michael cd27f96832
replace endl with '\n in config.cpp 5 years ago
Jeff Becker 2345dd3239
try adding proper limits 5 years ago
Jeff Becker c1f33bb1ac
initial mempipe implementation 5 years ago
Michael 91c1ba87cc
Change ConfigParser too 5 years ago
Michael 8fd4ceb55b
Don't use LoadFromString 5 years ago
Michael 5300568da5
Fix config builds 5 years ago
Jeff Becker 9a2ffb85e6
Merge remote-tracking branch 'origin/master' into ipv6-tun 5 years ago
Jeff b9cdfd116e correct worker threads amounts 5 years ago
Jeff Becker 8dab4b87bb
more logging 5 years ago
Michael 488695047f
Remove redundant else blocks 5 years ago
Michael 3ce90b678e
Allow override of the rest of the config 5 years ago
Michael 08d306f6e9
Have fromSection return void 5 years ago
Michael 937f28f75d
Move router config to be encapsulated 5 years ago
Michael f310160065
Fixup and add tests 5 years ago
Michael a2326efa37
Revert "Merge pull request #679 from tewinget/revert-config-refactor"
This reverts commit 2996a7f29c, reversing
changes made to 10df3bd4b3.
5 years ago
Thomas Winget d044d60101 Reverts #678 #677 and #669 with hashes:
10df3bd
766ece8
979f095

See those commits for further details
5 years ago
Michael b51f7d8015
Convert to load config in config loader 5 years ago
Michael bd78471dae
Move ini parser as well 5 years ago
Michael 00c237dc6d
Move config class to its own dir 5 years ago