Commit Graph

647 Commits

Author SHA1 Message Date
Jason Rhinelander
09c2b31b25 Move paths pumping into PumpLL 2021-11-15 18:24:07 -04:00
Jason Rhinelander
b3a8160c89 Pump hidden context sooner
This has to happen before pumping links because it is putting things on
links.
2021-11-15 13:38:05 -04:00
Jason Rhinelander
9844d358e6 Fix packet delay creep
- Make the main PumpLL also pump hidden services, rather than using
  separate wakers in each TunEndpoint.  It seems there is some
  interactions that just one or the other is not enough.

- Eliminate TunEndpoint send queue -- it isn't needed as we can just
  send directly.
2021-11-15 13:37:57 -04:00
Jason Rhinelander
78cc466bf2 Rename PumpLL -> TriggerPump
And rename the actual pump implementation back to PumpLL.
2021-11-15 13:37:47 -04:00
Jason Rhinelander
031ea7aa37 Get rid of external event loop direct wakeups
If something needs to wake up the event loop it should be using an
async, as we are now with PumpLL(); but we had various code triggering a
wakeup, expecting that PumpLL gets called on every wakeup, which isn't
true anymore.
2021-11-15 13:36:44 -04:00
Jason Rhinelander
74215fc44c Fix link layer delivery race condition (fix random ping delays)
We trigger a pump immediately, but this is racey because we add to our
plaintext data in a worker thread; if the worker thread runs after the
pump then it ends up leaving plaintext to be handled, but there's no
wakeup until the next one.

This was the cause of seeing a random +1s and bunching added to ping
responses sometimes: it wasn't until the *next* ping goes through the
network that the plaintext queue gets processed, at which point it
flushes the old one and often the new one together.

The fix here gets rid of the map of sessions needing wakeups and instead
adds an atomic flag to all of them to let us figure out which ones
need to be flushed.
2021-11-15 13:36:28 -04:00
Jason Rhinelander
9113a6b36b Triggered pumping
This redoes how/when we pump so that we should only be calling the
idempotent PumpLL() when we actually have (or may have) something to
pump.
2021-11-15 13:35:57 -04:00
Jason Rhinelander
bfc6d35b33 Simplifications & C++17
- Modernize some iterator loops
- Simplify a couple places by using `if (init; ...)`
- Replace various std::binds with lambdas
2021-11-14 10:11:00 -04:00
Jason Rhinelander
cf5c4e7284 outbound_message_handler: skip instead of aborting on removed paths 2021-11-14 10:10:19 -04:00
Jason Rhinelander
633431be66 Make outbound message queue PumpLL again if it doesn't send all 2021-11-14 10:10:19 -04:00
Jeff Becker
8a9025e234 only pump path context in idempotent pumpll 2021-11-14 10:07:31 -04:00
Jeff Becker
bb86996acf make event loop pump function non idempotent 2021-11-14 10:07:31 -04:00
Jeff Becker
8744c93944 prevent 100% cpu usage on service nodes
call_soon wakes up the mainloop and is often reentrant, we dont want to
ever way up the event loop but we also want to always defer the call so
we always use the workers
2021-11-14 10:07:11 -04:00
Jeff Becker
22d4b88edc
make PumpLL idempotent to reduce cpu use a bit 2021-11-09 11:59:57 -05:00
Sean
e11a94c95c
RPC call for summary get_status (#1742)
* RPC call for summary get_status

* lint

* update with review notes

* further review points

* uint64_t
2021-10-13 07:20:36 -04:00
Jeff Becker
5c457ff486
refactor logging to use std::source_location
* use std::source_location instead of godawful macros in logging
* remove unused/absolutely haram af json logstream
* fix bug in android logger where it doesn't respect eLogNone
2021-10-06 11:10:48 -04:00
Jeff Becker
d1246947f7
SystemD DNS fix:
when dns is port 53 call SetLinKDNS otherwise call SetLinkDNSEx as on older versions of systemd-resolved SetLinkDNSEx is not available.
2021-09-16 17:52:30 -04:00
Jeff Becker
9ad63140f2
use std::sample to grab MaxGossipPeers when populating std::unordered_set 2021-09-03 17:45:08 -04:00
Jeff Becker
a739e7b532
try not to prefer outbound vs inbound link sessions
before when we get the list of router ids for gossip it was highly bias towards outbound sessions.
instead now we get a full list of link session router ids in random order, truncate them to be at most MaxGossipPeers number of keys, and then put them into an unordered set
2021-09-03 17:45:08 -04:00
Jeff Becker
d91ce53da1
limit RC gossip to 20 peers max 2021-09-03 17:45:08 -04:00
Jeff Becker
64cd2990bc
remove old routing table maniuplation code 2021-08-27 11:07:54 -04:00
Jeff Becker
0871862452
initial routing table refactor
* move routing table manipulation to vpn platform
* add initial linux implementation of vpn platform route manipulation
2021-08-27 10:42:04 -04:00
Jeff Becker
e96ec156ea
add / remove route blackhole so we dont leak if we crash 2021-07-12 08:26:53 -04:00
Jeff Becker
14cc115489
dont use constexpr 2021-07-05 12:38:18 -04:00
Jeff Becker
069d9487b7
* throw exception on invalid SessionResult when transforming to SendStatus
* add case for printing unknown SessionResult
2021-07-05 09:18:28 -04:00
Jeff Becker
18cb59a1b5
* make tranform function for SessionResult to SendStatus
* add case for SessionResult::EstablishFail
* clean up outbound message handler to use transform function instead of many private member functions
2021-07-05 09:09:21 -04:00
Jeff Becker
75451d7124
* add establish fail enum
* dont call outbound session hooks for inbound sessions
2021-07-05 09:09:20 -04:00
Jeff Becker
e3281cd026
add string representation to SessionResult 2021-07-05 09:09:20 -04:00
Jeff Becker
1d1d97b0ef
disable peer status entirely 2021-07-05 09:09:20 -04:00
Jeff Becker
2578983a09
dont give peer stats in rpc 2021-07-05 09:09:20 -04:00
Jeff Becker
99379c5def
establish outbound sessions when we have no outbound session.
when we have an inbound session we still want to make an outbound session.
2021-07-05 09:09:20 -04:00
Jeff Becker
cf0349c259
if we have an inbound session don't fail with NoLink 2021-07-05 09:09:19 -04:00
Jeff Becker
f4fa83703f
refactor to use RouterID instead of rc.pubkey 2021-06-30 06:45:11 -04:00
Thomas Winget
8515fe09d4 fix minor oversight/inefficiency with already established connections 2021-06-29 18:44:42 -04:00
Jeff Becker
a24b82119b
fix #1655
* make it so that we don't set up unbound resolver when we have no resolvers provided by config
* clean up dns codepath and make it use llarp::SockAddr instead of llarp::IpAddress
2021-06-20 05:59:22 -04:00
Jeff Becker
5074dd5f2b
re-enable multithreading on clients but not on service nodes 2021-06-08 14:36:30 -04:00
Jeff Becker
d7a51e88f5
make router tick 250ms instead of 100ms to prevent excessive log spam
limit calls to decommissioned warning to every 30s to prevent excessive log spam
2021-06-08 14:36:30 -04:00
Jeff Becker
f3deabdb96
* get_failing does not need abstract router as paramter so we remove it
* add remove_node_from_failing to remove a node by pubkey from the failing set
* if a router is deregistered we remove it from the failing set so we don't retest it
* remove a router from the failing set if we get a test success
2021-06-08 10:47:27 -04:00
Jeff Becker
d88ed4eee0
make windows happy by making some constexprs non static and such as windows does not LTO 2021-06-08 05:46:05 -04:00
Thomas Winget
d68d39a450 make outbound session if we do not have
currently creating an outbound session will cancel if we have any session
at all with the relay.  instead, only cancel if we have an outbound session
to that relay.  this is useful for reachability testing.
2021-06-07 18:31:57 -04:00
Jeff Becker
37ab78b654
dont run router testing if we are decommissioned.
properly name function to be called LooksDecommissioned because that is different than deregistered
2021-06-07 16:35:06 -04:00
Jeff Becker
07d18b30c0
typofix 2021-06-07 16:18:52 -04:00
Jason Rhinelander
7c964800ba
Fix unintentional whitelist/greylist copying 2021-06-07 16:16:18 -04:00
Jeff Becker
ef924aea39
gossip RC when we are not deregistered so we can come back when we are decommissioned 2021-06-07 16:15:17 -04:00
Jeff Becker
95537804cd
separate white/grey list for active/decommissioned nodes.
allow sessions to decommissioned nodes but not paths.
2021-06-07 10:57:33 -04:00
Jason Rhinelander
28ba0b7533
Add logging about testing success/fail 2021-06-07 10:00:36 -04:00
Jeff Becker
d40484deea
handle case where we already have an outbound session, inform caller about it 2021-06-07 10:00:02 -04:00
Jeff Becker
c23e121139
capture by value to appease clang 11 2021-06-07 08:44:47 -04:00
Jeff Becker
e8af36ee91
there were some unhandled edge cases in outbound_session_maker, specifically when we are not permitted to connect to a remoute but we got its rc we silently drop the error. 2021-06-07 08:41:35 -04:00
Jeff Becker
9ad90d029d
* use weak_ptr on core rpc
* use reachability testing code lifted storage server's code
2021-06-07 08:41:35 -04:00