Commit Graph

7427 Commits

Author SHA1 Message Date
majestrate
64224f2344
Merge pull request #1822 from majestrate/make-windows-work-again-2021-12-07
Make windows work again
2021-12-15 15:39:00 -05:00
Jeff
776e9227fd
make serivce::Endpoint::EnsurePathToService have a default timeout as a named constant. 2021-12-15 15:25:53 -05:00
Jeff
301b19bd0f
do not send buggy reply as rpc 2021-12-15 15:25:53 -05:00
Jeff
388fc53380
match io loop event order on windows/apple to match linux.
on win32/apple reading packets from the interface does not count as an io operation.
manually trigger pump on win32/apple to pretend that it is an io event.
add platform quark function MaybeWakeUpperLayers on vpn::Interface to manaully wake up the other components on platforms that need that (ones on which packet io is not done via io events).
on non linux platforms, use uv_prepare_t instead of uv_check_t as the former triggers before blocking for io, instead of after. this better matches linux's order of operations in libuv.
2021-12-15 15:25:53 -05:00
majestrate
44c7cf5f27
Update readme.md
remove old parts about macos from readme
2021-12-13 22:59:29 -05:00
majestrate
019a9f1611
Update readme.md
remove pedantic separation in readme
2021-12-13 22:58:05 -05:00
majestrate
6af589d845
Update readme.md
correct cmake flag
2021-12-13 22:57:11 -05:00
majestrate
d186a887d3
Update readme.md
remove note in readme
2021-12-13 22:55:51 -05:00
majestrate
b7bbb7f40d
Update readme.md
fix readme, do not use static deps.
2021-12-13 22:53:53 -05:00
Jeff
5890c99a81
Merge pull request #1817 from majestrate/disable-upstream-ip6-dns-2021-12-03
disable ip6 upstream dns in libunbound
2021-12-04 09:19:34 -05:00
Jeff Becker
0e2b0edaf6
when lokinet looses ip4 connectivity libunbound used to freak out and only use ip6 after such an event.
as a result dns queries stop working because we blackhole ip6 routes if exit mode is on.
this prevents this case from being hit.
2021-12-03 16:12:10 -05:00
Jeff
ce8b3c83a7
Update high-level.txt
add notice to file as very out of date.
2021-11-28 14:01:12 -05:00
Jeff
b23ceefc5a
Merge pull request #1812 from majestrate/log-level-demotion-11-28-2021
demote log statement levels
2021-11-28 11:02:36 -05:00
Jeff Becker
ec8d990163
demote log statement levels 2021-11-28 09:57:10 -05:00
Jeff
d7529dafbc
Merge pull request #1811 from majestrate/android-ci-optimize-2021-11-23
parallelize android build much better
2021-11-23 17:48:19 -05:00
Jeff Becker
8c6bf31c52
paralellize android build much better
* split up configure step and build step so that build steps goes all at once
* update ci to use new build structure for android
2021-11-23 12:43:54 -05:00
Jason Rhinelander
5de5091e8d docker CI: Fix error message 2021-11-16 20:24:47 -04:00
Jason Rhinelander
d24f89192d Bump version 2021-11-16 19:50:52 -04:00
Jeff
e4514aec3d
Merge pull request #1799 from majestrate/static-ci-disable-lokinet-bootstrap-2021-11-16
disable lokinet-bootstrap in static linux ci pipeline
2021-11-16 10:29:16 -05:00
Jeff Becker
e7d282993a
in static linux ci pipeline disable building lokinet-bootstrap and bundle a bootstrap.signed 2021-11-16 09:43:08 -05:00
Jeff
b95e53daf9
Merge pull request #1797 from jagerman/random-optimizations
Random optimizations
2021-11-15 20:54:50 -05:00
Jason Rhinelander
5115162066 Use libuv's cached current time for time_now()
We are calling time_now() a huge amount, and it is a major consumer of
CPU cycles, but we don't need it: most of the time the current event
loop time is enough.
2021-11-15 18:32:05 -04:00
Jason Rhinelander
b2ee003329 Optimization: eliminate unneeded shared_ptrs
We have a few cases where we're making an extra shared_ptr which we copy
into a lambda, which then results in an extra unnecessary refcount
decrement in the parent; this changes them to give an rvalue reference
to the lambda to avoid the extra incr/decr instead.

The one in Session::Pump is particularly noticeable and shows up in
profiling.
2021-11-15 18:32:03 -04:00
Jeff
3fc172f4dd
Merge pull request #1796 from jagerman/hotloop-optimization
Avoid std::function in hot pump code
2021-11-15 17:30:09 -05:00
Jason Rhinelander
7a04911b9b Avoid std::function in hot pump code
We're seeing overhead here of the std::function invocation, which we can
easily avoid in this case by not using a std::function around the
callback.
2021-11-15 18:29:26 -04:00
Jason Rhinelander
f270d74441
Merge pull request #1795 from majestrate/try-reducing-cpu-usage-2021-11-09
make PumpLL idempotent to reduce cpu use a bit
2021-11-15 18:28:52 -04:00
Jason Rhinelander
09c2b31b25 Move paths pumping into PumpLL 2021-11-15 18:24:07 -04:00
Jason Rhinelander
687b54f860 Abstract & simplify logic 2021-11-15 17:15:16 -04:00
Jason Rhinelander
711038d150 Remove debug comment 2021-11-15 16:57:17 -04:00
Jason Rhinelander
f63fff37a3 Remove broken test
This test isn't very useful, but also broken with the other changes on
this branch.
2021-11-15 16:20:07 -04:00
Jason Rhinelander
0fe7153f6e Fix client latency bug; De-shared_ptr IHopHandler queues
- Replace m_FlushWakeup with a call to the router's god mode pump
  method.  m_FlushWakeup apparently isn't enough to get things out, and
  we can end up with incoming packets that don't get properly handled
  right away without it.

- The shared_ptr around the ihophandler queues isn't needed and is just
  adding a layer of obfuscation; instead just exchange the list directly
  into the lambda.

- Use std::exchange rather than swap

- A couple other small code cleanups.
2021-11-15 13:39:57 -04:00
Jason Rhinelander
70553c7627 Remove hopeless flush
The TriggerPump just below this is *already* going to trigger a flush,
so the extra flush call here can't do anything useful (and in
particular, it won't clear up the queue *immediately*, which is what
this code looks like it was aimed at doing).
2021-11-15 13:39:52 -04:00
Jason Rhinelander
fbc5cb0a6d Add another missing pump trigger 2021-11-15 13:38:24 -04:00
Jason Rhinelander
bce7e2e56d Pump outbound context 2021-11-15 13:38:21 -04:00
Jason Rhinelander
846577a0aa Add missing inbound traffic pump trigger 2021-11-15 13:38:10 -04:00
Jason Rhinelander
8cdde74020 Simplify 2021-11-15 13:38:08 -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
0924dd8862 Remove dead declaration 2021-11-15 13:38:02 -04:00
Jason Rhinelander
f9395cd5dd Cleanup: avoid pointless copy of this pointer 2021-11-15 13:38:00 -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
99b12940ad Cleanups 2021-11-15 13:37:54 -04:00
Jason Rhinelander
e47d3098ac Increase plaintext queue size from 32 to 512
In testing we were sometimes hitting a full queue error, which makes
sense because the queue size seems really small.

Increase it to 512.
2021-11-15 13:37:49 -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
aa1dc83459 Simplify 2021-11-15 13:36:13 -04:00
Jason Rhinelander
362fda5a56 Combine empty + pop into single call 2021-11-15 13:36:09 -04:00
Jason Rhinelander
b03f3c2d79 Remove another unwanted unconditional PumpLL 2021-11-15 13:36:03 -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