1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
Commit graph

155 commits

Author SHA1 Message Date
Jason Rhinelander e470a6d73e C++17 niceties
- class template argument deduction lets us write `std::unique_lock
  foo{mutex}` instead of `std::unique_lock<mutex_type> foo{mutex}` which
  makes the `unique_lock` and `shared_lock` functions unnecessary.

- Replace GNU-specific warn_unused_result attribute with C++17-standard
  [[nodiscard]]

- Remove pre-C++17 workaround code for fold expressions, void_t
2020-05-12 16:42:35 -03:00
Stephen Shelton de8e44ba21
Re-apply clang-format rules after rebasing 2020-04-07 14:41:11 -06:00
Stephen Shelton 6d001c5fd2
Opportunistically move 'netdb' to 'nodedb' 2020-04-07 14:29:47 -06:00
Stephen Shelton 3c6a127dce
Complain loudly when we can't create nodedb dirs 2020-04-07 14:28:23 -06:00
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.
2020-04-07 12:38:56 -06:00
Jeff 3f4b2a53fa
add additional case (#1180)
* add additional case for if we are near the end and all elements are in the exlcude set

* fix stop condition in second loop
2020-03-11 17:45:48 -03:00
Jeff Becker a1e8500035
use for loop 2020-03-11 16:25:19 -04:00
Jeff Becker 1ea210ace6
typo fix 2020-03-11 16:18:17 -04:00
Jeff bf82740c08
only try fetching identity key once so we can interrupt lokinet (#1178) 2020-03-11 13:05:46 -03:00
Jeff Becker 9cdc7f498d
remove dead code 2020-03-11 10:12:29 -04:00
Jeff Becker 69126c67df
code dedup 2020-03-11 10:08:53 -04:00
Jeff Becker 6047d578f8
fully randomize hop selection 2020-03-10 12:19:24 -04:00
Jeff Becker d2d109e92c
llarp_time_t is now using std::chrono 2020-02-24 15:25:03 -05:00
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
2020-02-21 23:22:47 -04:00
Jason Rhinelander ce90b9dc7b clang format 2020-02-14 17:45:22 -04:00
Jason Rhinelander 25a796d940 Rework partial sorting code: use pointers, add lock
Changes to code to sorts a set of pointers instead of full records, then
copy those out into the final results that we return.
2020-02-14 17:45:22 -04:00
Jeff Becker 83ee508fe1 comparison fix 2020-02-14 17:43:13 -04:00
Stephen Shelton 906803e387 Refactor DHT introset lookups to use redundant lookup strategy 2020-02-14 17:43:13 -04:00
Jeff Becker 49f696de9c
connect to closer nodes for introset lookups 2020-01-23 12:10:57 -05:00
Stephen Shelton 702c130020
Remove dead code in llarp_nodedb::Insert() 2020-01-15 21:44:25 -07:00
Jason Rhinelander eadfeefafc
Merge pull request #1038 from majestrate/dht-disable-iterative-lookup-2020-01-14
disable iterative behavior in DHT
2020-01-16 00:22:12 -04:00
Jeff Becker 6fd714d193
contrib/testnet: fix up testnet config generator to make super centralized topology
llarp/context.cpp, llarp/nodedb.{h,c}pp: load netdb AFTER whitelist
llarp/router/router.cpp: explore always
llarp/router/{i,}rc_lookup_handler.{h,c}pp explore with whitelist, update routers with lookup before stale
2020-01-14 15:12:47 -05:00
Jeff Becker b56a3528db
periodic nodedb flush 2020-01-14 12:01:41 -05:00
Jeff Becker c7b94f32be
reduce disk io 2020-01-12 07:30:03 -05:00
Jeff Becker 56dce90de9
add trace log level for tracking logic thread jobs 2019-11-22 16:23:19 -05:00
jeff ac2a2aed1d gut libutp and finish making things compile and pass tests 2019-09-12 14:19:25 -04:00
Michael edd0ec398f
Move thread stuff to subdirectory 2019-09-03 20:52:28 +01:00
Michael 1aec0dfa2b
Move logging to subdirectory 2019-09-03 20:52:27 +01:00
Michael 16cdfbd5f0
clang-tidy modernize pass 2019-08-12 16:52:58 +01:00
Thomas Winget baf8019fe5 Refactor Router code into more classes
This commit refactors functionality from the Router class into separate,
dedicated classes.
There are a few behavior changes that came as a result of discussion on
what the correct behavior should be.
In addition, many things Router was previously doing can now be provided
callback functions to alert the calling point when the asynchronous
action completes, successfully or otherwise.
2019-07-25 14:11:02 -04:00
Jeff Becker a0f32fde13
reduce logging 2019-07-17 08:25:51 -04:00
Jeff Becker b0d850afb5
durable write for nodedb 2019-07-15 13:19:31 -04:00
Jeff Becker b9bcc2b775
make threadpool consice 2019-07-09 09:47:24 -04:00
Jeff Becker 54a098356d
continue using llarp::openfilestream 2019-06-24 12:39:03 -04:00
Jeff Becker f56273eb6a
fix comparision 2019-06-20 10:01:34 -04:00
Jeff Becker aadde2e9c6
save all nodedb entries in memory on exit 2019-06-17 10:23:38 -04:00
Jeff Becker 9ec41b8831
update RC expiration logic, lookup more often and remove stale entries 2019-06-10 08:47:21 -04:00
Michael 491fee206b
Port code to use CryptoManager over passing Crypto pointers 2019-05-28 20:45:08 +01:00
Jeff Becker 64c7ed42fc
make format 2019-05-22 12:20:50 -04:00
Jeff Becker 9c96aecf3f
move llarp::Logic to std::shared_ptr
add sequence numbers to HSD messages

begin work on network isolation code

add more docs
2019-05-22 12:20:03 -04:00
Michael 636bb2a17d
Convert router diskworker to use a modern ThreadPool 2019-05-18 23:04:08 +01:00
Jeff Becker 94eb37d490
bundle RC in build record to improve build success rates. 2019-04-17 15:05:54 -04:00
Jeff 5834607997 * don't ban bootstrap nodes with profiling
* less vigorous profiling timeouts
* async remove rc from disk
2019-04-14 07:25:15 -04:00
Jeff Becker 5af8d0a392
don't insert RCs in main thread 2019-03-29 11:08:31 -04:00
Jeff Becker d4cb6808ec
more 2019-03-25 11:41:37 -04:00
Jeff Becker fbb2c78d3c
async remove dead rc files when we think they are dead 2019-03-25 09:52:22 -04:00
Jeff Becker 5d3833ef1a
fix dumb as shit path building that causes premature termiantion because of duplicate hops 2019-03-11 09:58:31 -04:00
Michael 61f3273dc4
Add threading annotations and fix potential deadlocks 2019-03-04 00:03:52 +00:00
Michael c5a129ddff
Convert to use abseil synchronisation primitives 2019-03-03 21:20:38 +00:00
Jeff Becker 2dfb53ef13
prevent deadlock 2019-02-08 08:04:12 -05:00