Commit Graph

121 Commits

Author SHA1 Message Date
Stephen Shelton
aee96e53a3
Refactor Addr -> IpAddress/SockAddr 2020-05-06 14:38:44 -06:00
Jason Rhinelander
1697bf90fe C++17
Compiles with C++17, replaces ghc::filesystem with std::filesystem,
nonstd::optional with std::optional, and llarp::string_view with
std::string_view.
2020-05-01 17:43:27 -03: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
Stephen Shelton
ea835405c5
Refactor NotifyRouterEvent() to forward args, event code cleanup
This template-ifies Router::NotifyRouterEvent() up so that it accepts
the arguments to instantiate the specified event type, forwarding them
to std::make_unique. This would allow (in the future) the function to
no-op the call and avoid memory allocation. It also slightly reduces
the amount of code required to fire an event.

This commit also simplifies some of the RouterEvent code to reduce
redundancy.
2020-03-12 11:50:46 -06:00
Thomas Winget
84a1d7dbcc clang format....... 2020-03-06 20:20:11 -05:00
Thomas Winget
c8c66f0a5f some refactoring of tooling code, added RCGossipReceivedEvent 2020-03-03 19:57:09 -05:00
Thomas Winget
df0380e746 LRSM RouterEvent, added to hive test and test passes. 2020-03-03 19:57:09 -05:00
Thomas Winget
771d0b4489 hive pytest framework in place (and path build test works)! 2020-03-03 19:57:09 -05:00
Thomas Winget
a9882ad475 PathRequestReceivedEvent implemented 2020-03-03 19:57:09 -05:00
Jeff Becker
32e768d7dd
change log 2020-03-02 12:33:33 -05:00
Jeff Becker
bf0416cab8
remove Time_t, add operator overload for printing llarp_time_t and add to_json function for serializing llarp_time_t to json 2020-02-25 12:05:13 -05:00
Jeff Becker
d2d109e92c
llarp_time_t is now using std::chrono 2020-02-24 15:25:03 -05:00
Jason Rhinelander
089056ca5b Remove all ABSL_ATTRIBUTE_UNUSED uses 2020-02-24 14:27:44 -04:00
Jason Rhinelander
f84ce61d66 Removed empty cpp files
These aren't needed: CMake already knows how to follow #includes and
rebuild when headers change as long as the headers are included
*somewhere*.  The extra .cpp files here just require building a bunch of
.cpp files with just header content that we just end up throw away
during linking (since the same things will also be compiled in whatever
other compilation units include the same headers).
2020-02-21 23:39:11 -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
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").
2020-02-19 18:21:25 -04:00
Jeff Becker
9efd796145
initial wack at 0.7.0 dht fixes 2020-01-27 11:54:51 -05:00
Jeff Becker
4185d47d4b
link layer message priority 2020-01-18 16:55:45 -05:00
Jeff Becker
ecf2685aa3
use optional 2019-12-30 16:06:57 -05:00
Jeff Becker
d7c78b0c71
comments 2019-12-30 15:57:09 -05:00
Jeff Becker
f3e96e06b2
propagate error to client 2019-12-30 15:55:56 -05:00
Jeff Becker
a9c9fe9c24
limit client side path builds per ip 2019-12-30 15:15:19 -05:00
Stephen Shelton
66a058a2af Make format 2019-12-06 10:13:09 -07:00
Stephen Shelton
93b8832026
Merge branch 'dev' into private-keys-backup-support 2019-12-03 11:20:45 -07:00
Jeff Becker
56dce90de9
add trace log level for tracking logic thread jobs 2019-11-22 16:23:19 -05:00
Stephen Shelton
db56e17c23 Rename bencode function for clarity 2019-11-22 14:14:37 -07:00
Stephen Shelton
1666498405 Replace bencode_write_version_entry with a more general-purpose function for writing bencoded dictionary entries 2019-11-22 10:39:35 -07:00
Jason Rhinelander
d96d33329b
Merge pull request #912 from majestrate/logic-thread-fix-2019-11-13
fix logic thread behavior
2019-11-19 15:26:35 -04:00
Jason Rhinelander
6524563d33
Merge pull request #897 from majestrate/bencode-seek-for-version-2019-11-03
seek for version and set it before deserializing
2019-11-19 15:24:07 -04:00
Jeff Becker
b34caa3e26
make unit tests pass for iwp 2019-11-14 11:48:02 -05:00
Thomas Winget
75512b1b58 ban zero id for pathid; clarity and cleanup 2019-11-06 10:26:51 -05:00
Thomas Winget
9d3e7d349c Add per-path queues, prioritize control messages over traffic 2019-11-06 10:26:51 -05:00
Jeff Becker
9d266dbec7
meh 2019-11-03 15:52:00 -05:00
Jeff Becker
bdb0b847f8
seek for version and set it before deserializing 2019-11-03 10:31:01 -05:00
Jeff Becker
5cdd92e2a3
remove more locking and make it safe 2019-09-04 08:24:17 -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
Michael
4763888d2c
Add fail-able docker build for gcc trunk 2019-08-02 10:28:09 +01:00
Thomas Winget
697ece64cc make TransitHop self-destruct if path is invalidated 2019-07-25 19:54:10 -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
Michael
488695047f
Remove redundant else blocks 2019-07-09 22:54:46 +01:00
Michael
08609f9e5a
Rename message files 2019-06-19 23:30:07 +01:00
Michael
68063b320c
Rename InboundMessageParser to LinkMessageParser 2019-06-19 21:48:25 +01:00
Michael
8884d0d9d4
Merge changes from upstream 2019-06-19 21:40:40 +01:00
Michael
333b23b59c
Tweak link message parser 2019-06-19 21:35:57 +01:00
Michael
8a058fcb34
Move other messages 2019-06-19 21:35:57 +01:00
Michael
83bd9227a7
Move exit messages 2019-06-19 21:35:26 +01:00