Commit Graph

39 Commits

Author SHA1 Message Date
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
99eb7726ff
initial dht key blinding 2020-01-27 16:30:41 -05:00
Jeff Becker
8b8d636ded
make format 2019-12-22 09:16:28 -05:00
Thomas Winget
71bb0dd520 implement timers using libuv
So far only a bit of the code using timers has been modified to use
the new libuv-based timers.  Also only the non-Windows case has been
implemented.  Seems to be working though, so it's a good time to commit.
2019-12-18 13:11:13 -05:00
Jeff Becker
1a864832c8
make format 2019-11-14 10:07:40 -05:00
Thomas Winget
23a9773e1e
remove our paths from outbound queues 2019-11-07 13:23:14 -05:00
Thomas Winget
ef1a5652ef
remove our paths from outbound queues 2019-11-07 13:23:06 -05:00
Jeff Becker
7ee026fa50
make path builds work again 2019-11-05 11:58:53 -05:00
Jeff Becker
327c545530
finish multithread cryptography first pass 2019-09-16 12:12:05 -04:00
jeff
14c9ef15ed try calling stuff in logic thread from event loop 2019-09-16 06:21:12 -04:00
Jeff Becker
4bf6882c8a
more async cryptography 2019-09-05 13:39:09 -04:00
Michael
edd0ec398f
Move thread stuff to subdirectory 2019-09-03 20:52:28 +01:00
Jeff Becker
aa0a795689
call path build fail stuff in logic thread 2019-07-31 08:51:24 -04:00
Thomas Winget
38fd0552d3 Adds Link-Relay Status Messages
Success case:
  - the path endpoint creates and sends a LR_StatusMessage upon
    successful path creation

Failure case:
  - an intermediate hop creates and sends a LR_StatusMessage upon
    failure to forward the path to the next hop for any reason

Both cases:
  - transit hops receive LR_StatusMessages and add a frame
    to them reflecting their "status" with respect to that path
  - the path creator receives LR_StatusMessages and decrypts/parses
    the LR_StatusRecord frames from the path hops.  If all is good,
    the Path does as it would when receiving a PathConfirmMessage.
    If not, the Path marks the new path as failed.

LR_StatusMessage is now used/sent in place of PathConfirmMessage
2019-07-25 17:46:56 -04:00
Jeff Becker
7a3c8e5ca0
set limits correctly 2019-07-18 12:32:26 -04:00
Jeff Becker
f48754c45d
make hop count and length configurable 2019-07-18 12:28:17 -04:00
Jeff Becker
64e9622270
start seperating tun and endpoint 2019-07-01 09:44:25 -04:00
Michael
b6b400baef
Tidy up pathbuilder code 2019-06-20 17:35:40 +01:00
Jeff Becker
9ea13a9ee3
ingore paths that drop exit traffic 2019-05-31 06:57:41 -04:00
Jeff Becker
df322e1149
don't include duplicate hops in paths 2019-05-08 10:01:31 -04:00
Jeff Becker
a53da68700
start work on sighup 2019-05-07 13:46:38 -04:00
Jeff Becker
34533db620
add urgent build that builds over an existing path for an endpoint 2019-05-07 08:31:34 -04:00
Jeff Becker
5fa85acaf7
rebuild exit paths if they die 2019-05-06 10:54:05 -04:00
Jeff Becker
d423ee02d2
use shared_ptr 2019-05-03 09:15:03 -04:00
Jeff Becker
6711296b26
finish converting to shared_ptr 2019-04-23 12:13:22 -04:00
Jeff Becker
99c29cf05a
prepare for ios/android jazz
move to use std::shared_ptr instead of bare pointers so we can
multithread everything.
2019-04-23 10:28:59 -04:00
Michael
98e691f315
Tidy up more parts of the service/ directory 2019-04-22 22:28:10 +01:00
Jeff Becker
b849ff9a94
handle path death better 2019-03-30 09:02:10 -04:00
Jeff Becker
ce126166af
more logging info 2019-03-22 10:10:30 -04:00
Jeff Becker
6489ea2152
make it work 2019-03-08 12:26:29 -05: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
Michael
887fb4ac62
Replace insert(make_pair()) with emplace() 2019-02-18 10:35:23 +00:00
Michael
048fa83c39
Finish replacement of Router with AbstractRouter 2019-02-14 22:31:31 +00:00
Jeff Becker
66753430ad
fix it 2019-02-08 16:29:56 -05:00
Jeff Becker
e1522faeaa
add introspection rpc endpoint 2019-02-08 14:43:25 -05:00
Jeff Becker
a953b34a45
fix crash 2019-02-05 10:06:53 -05:00
Michael
7296ebcbe8
Tidy dht code 2019-01-19 01:41:14 +00:00
Michael
081d4dfa32
Reorganise source into more folders 2019-01-11 01:19:49 +00:00