Commit Graph

23 Commits

Author SHA1 Message Date
Jason Rhinelander
5c95971335 Make C++ literals available everywhere in llarp 2020-02-24 14:27:44 -04: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
Jeff Becker
7ad47f2dba
* get rid of dht explore for service nodes
* add Time_t using std::chrono for future uses
* make decaying hashset constructor with llarp_time_t explicit
* add decaying hashset implicit constructor using Time_t
* add timeouts for gossiper replay
* allow regossip of our RC
2020-02-12 12:10:48 -05:00
Stephen Shelton
bc3184a126
s/LogInfo/LogDebug/ @ explore message 2020-02-06 11:57:39 -07:00
Jeff Becker
b280bac141
don't always use bootstrap when exploring 2020-01-23 12:49:33 -05:00
Jeff Becker
c3f99e1b5c
make format 2020-01-18 16:53:42 -05:00
Jeff Becker
fe148f7823
merge conflict fix 2020-01-18 15:55:50 -05:00
Stephen Shelton
3cf4bd8f97
Lookup routers at maximum frequency of 10 minutes 2020-01-17 14:54:34 -07:00
Stephen Shelton
169ece08e8
Fix HaveReceivedWhitelist() typo 2020-01-16 14:32:52 -07:00
Stephen Shelton
fbb274a724
Make format (mutter mutter) 2020-01-15 21:15:37 -07:00
Stephen Shelton
8206557ac7
Don't respect whitelist when we haven't received it yet 2020-01-15 21:12:38 -07:00
Stephen Shelton
08149112b2
Randomize routers to explore in ExploreNetwork() 2020-01-15 19:16:18 -07: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
265da6f37b use get_service_nodes rpc endpoint 2019-10-14 11:38:34 -04:00
Jeff Becker
1adae338ce
Merge remote-tracking branch 'origin/master' 2019-09-04 07:58:02 -04:00
Michael
edd0ec398f
Move thread stuff to subdirectory 2019-09-03 20:52:28 +01:00
Michael
4d8fe2a8a8
Move meta programming to subdirectory 2019-09-03 20:52:28 +01:00
Jeff Becker
c01112e4b7
tracy lock contention testing and other fun things 2019-09-03 11:56:56 -04:00
Jeff Becker
ba2aaa68c6
add short data fragments and rx replay filter 2019-08-28 07:02:00 -04:00
Jeff Becker
835b334a59
* increase utp buffers
* disallow inbound traffic on outbound utp link
* const correctness
2019-07-28 11:26:38 -04:00
Jeff Becker
16e6ab2193
propagate all utp link errors 2019-07-28 09:00:12 -04:00
Jeff Becker
503bea19cd
make travis happy 2019-07-28 08:35:07 -04: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