Commit Graph

174 Commits

Author SHA1 Message Date
Jason Rhinelander
ba1b20153e Miscellaneous small absl removals 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
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
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
fcf0ae2b9e
prune unused files. 2019-12-15 07:02:17 -05:00
Jason Rhinelander
638fb25b47 Put version info into a compiled file
This rewrites the version info using lokid's approach of compiling it
into a .cpp file that gets generated as part of the build (*not* during
the configure stage).

Among other things, this means that changing the version no longer
invalidates ccache or cmake dependencies, and because it depends on
`.git/index` git commits will cause the version to be regenerated,
making the commit tag more reliable (currently if you rebuild without
running cmake your git commit tag doesn't update).
2019-12-11 22:40:07 -04:00
Jeff Becker
8455d5d1cf more cleanup 2019-12-10 11:49:32 -07:00
Jeff Becker
581306e35f prevent crash on exit 2019-12-10 11:49:32 -07:00
Jeff Becker
f56e543d75
add deadlock checker and revert bencode change from long ago 2019-12-07 14:58:19 -05:00
Jeff Becker
dd48b149ca
make job queue size configurable 2019-11-25 16:30:34 -05:00
Jeff Becker
56dce90de9
add trace log level for tracking logic thread jobs 2019-11-22 16:23:19 -05:00
jeff
2425c2ba03 update comment 2019-10-09 09:21:41 -04:00
jeff
cdb5610d90 close async 2019-10-09 09:10:48 -04:00
jeff
58a25602f5 more fixes, implemenmt missing functions 2019-10-09 09:08:38 -04:00
jeff
c26b67c379 finish wiring up jni shizz 2019-10-08 10:52:01 -04:00
jeff
52757fef0e Merge remote-tracking branch 'micheal/background_mode' into vpn-api-2019-10-03 2019-10-04 14:10:58 -04:00
Michael
15cb49c9bd
Introduce --background to only start JSON RPC
fixes #853
2019-10-04 10:32:52 +01:00
Jeff Becker
e3bb59707e
more 2019-09-05 17:28:50 -04:00
Jeff Becker
d11321366c
make it compile 2019-09-04 08:43:50 -04:00
Jeff Becker
12314e8d00
ensure no crash on quit 2019-09-04 08:41:07 -04:00
Michael
edd0ec398f
Move thread stuff to subdirectory 2019-09-03 20:52:28 +01:00
Michael
0950571313
Move metrics 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
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
Jeff
183ec25717
Merge pull request #729 from majestrate/fix-android-2019-07-24
make android compile again
2019-07-25 14:24:13 -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
Jeff Becker
43cb62af16
fix android compile, have makefile pull in libuv for cmake on android 2019-07-24 11:25:40 -04:00
Jeff Becker
16e20a9e79
try fixing bootstrap 2019-07-15 12:56:09 -04:00
Jeff
284a352dda fix previous commit 2019-07-13 07:57:41 -04:00
Jeff
b9cdfd116e correct worker threads amounts 2019-07-13 07:54:58 -04:00
Jeff Becker
1fd6b5ae74
Merge remote-tracking branch 'origin/master' into ipv6-tun 2019-07-12 09:53:52 -04:00
Jeff Becker
749ee7cb9f
make it compile 2019-07-10 10:11:06 -04:00
Jeff Becker
fcc3c05124
Merge remote-tracking branch 'origin/master' into ipv6-tun 2019-07-10 10:07:19 -04:00
Michael
488695047f
Remove redundant else blocks 2019-07-09 22:54:46 +01:00
Jeff Becker
edd3611166
correct name 2019-07-09 10:05:31 -04:00
Jeff Becker
ec6a1cfddc
make it compile 2019-07-09 09:58:16 -04:00
Jeff Becker
84407b3557
make it compile 2019-07-09 09:54:13 -04:00
Jeff Becker
b9bcc2b775
make threadpool consice 2019-07-09 09:47:24 -04:00
Michael
3ce90b678e
Allow override of the rest of the config 2019-07-09 00:29:43 +01:00
Michael
937f28f75d
Move router config to be encapsulated 2019-07-09 00:29:43 +01:00
Michael
f310160065
Fixup and add tests 2019-07-06 14:46:25 +01:00
Michael
a2326efa37
Revert "Merge pull request #679 from tewinget/revert-config-refactor"
This reverts commit 2996a7f29c, reversing
changes made to 10df3bd4b3.
2019-07-06 14:46:25 +01:00
Thomas Winget
d044d60101 Reverts #678 #677 and #669 with hashes:
10df3bd
766ece8
979f095

See those commits for further details
2019-07-02 11:02:20 -04:00
Michael
b51f7d8015
Convert to load config in config loader 2019-07-02 01:58:39 +01:00
Michael
00c237dc6d
Move config class to its own dir 2019-07-02 01:58:38 +01:00
Michael
fedf6cb8e0
Send netid to metrictank 2019-06-20 00:00:59 +01:00
Rick V
5092a1fa85
restore llarp_make_ev_loop() as we only use libuv now; separate function is now ded code 2019-06-17 23:29:46 -05:00
Michael
c0525f2ea3
Move local publishers to their own files 2019-06-15 15:48:48 +01:00
Jeff Becker
9ec41b8831
update RC expiration logic, lookup more often and remove stale entries 2019-06-10 08:47:21 -04:00