Commit Graph

538 Commits (b81f7025c9a619409bb1c3f39e0c56e2084fd7be)

Author SHA1 Message Date
Jason Rhinelander b81f7025c9
Replace logging with oxen-logger
Replaces custom logging system with spdlog-based oxen logging.  This
commit mainly replaces the backend logging with the spdlog-based system,
but doesn't (yet) convert all the existing LogWarn, etc. to use the new
format-based logging.

New logging statements will look like:

    llarp::log::warning(cat, "blah: {}", val);

where `cat` should be set up in each .cpp or cluster of .cpp files, as
described in the oxen-logging README.

As part of spdlog we get fmt, which gives us nice format strings, where
are applied generously in this commit.

Making types printable now requires two steps:
- add a ToString() method
- add this specialization:

      template <>
      constexpr inline bool llarp::IsToStringFormattable<llarp::Whatever> = true;

This will then allow the type to be printed as a "{}" value in a
fmt::format string.  This is applied to all our printable types here,
and all of the `operator<<` are removed.

This commit also:
- replaces various uses of `operator<<` to ToString()
- replaces various uses of std::stringstream with either fmt::format or
  plain std::string
- Rename some to_string and toString() methods to ToString() for
  consistency (and to work with fmt)
- Replace `stringify(...)` and `make_exception` usage with fmt::format
  (and remove stringify/make_exception from util/str.hpp).
2 years ago
Jason Rhinelander 3cd699fa7f
Show router pubkey at startup 2 years ago
Jeff 1eba0f836e
replace LLARP_PROTO_VERSION macro 2 years ago
Jeff 98b3860655
set source ip on service nodes for outbound link to not use all interfaces 2 years ago
Jeff 60ada470db
format systemd status as time deltas from now 2 years ago
Jeff 18e1272c76
add gossip info to systemd status
* adds next and last gossip datetimes
* adds a few things for time points, like ostream operator overloads for time point
2 years ago
Jeff 3c44a06403
publish our rc out to the network when we regenerate them 2 years ago
Jeff 5f496259b7
if we are decommissioned or deregistered, do not test other routers so we do not spam them.
disambiguiate error message to distinguish between decomissioned and deregistered.
2 years ago
Jeff 706e34c082
connect to routers even if we are decomissioned 2 years ago
Jeff a76acd4956 fix wire protocol race condition
only send close packet once, before we were sending a close after we got a close causing excess log spam.
include handshake phase when checking for connection timeouts.

when we change our rc make sure to put it into nodedb too when we are a service node to prevent weirdness in dht lookups.
2 years ago
Jeff eeb93343c0 rpc fixes for lokinet gui
only add stats for services when we have them
2 years ago
audric 41405be612 summary status: no services means not running 2 years ago
Audric Ackermann ad6d206aa6
add version and uptime to summary status endpoint 2 years ago
Audric Ackermann d9467f4dee fix numPaths value in Router::ExtractSummaryStatus 2 years ago
Jeff fc444741f1 move constant to new header
create llarp/constants/time.hpp for time/duration constants
2 years ago
Jeff 5fac6c84d8 detect timeskip and thaw network when we think it happened. 2 years ago
Jeff 205584acdf redo systemd status line to include number of paths and endpoint count. optionally warn about low path success. 2 years ago
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.
2 years ago
Jason Rhinelander 09c2b31b25 Move paths pumping into PumpLL 3 years ago
Jason Rhinelander b3a8160c89 Pump hidden context sooner
This has to happen before pumping links because it is putting things on
links.
3 years ago
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.
3 years ago
Jason Rhinelander 78cc466bf2 Rename PumpLL -> TriggerPump
And rename the actual pump implementation back to PumpLL.
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
Jason Rhinelander 633431be66 Make outbound message queue PumpLL again if it doesn't send all 3 years ago
Jeff Becker 8a9025e234 only pump path context in idempotent pumpll 3 years ago
Jeff Becker bb86996acf make event loop pump function non idempotent 3 years ago
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
3 years ago
Jeff Becker 22d4b88edc
make PumpLL idempotent to reduce cpu use a bit 3 years ago
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
3 years ago
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
3 years ago
Jeff Becker 64cd2990bc
remove old routing table maniuplation code 3 years ago
Jeff Becker e3281cd026
add string representation to SessionResult 3 years ago
Jeff Becker 1d1d97b0ef
disable peer status entirely 3 years ago
Jeff Becker 2578983a09
dont give peer stats in rpc 3 years ago
Jeff Becker 5074dd5f2b
re-enable multithreading on clients but not on service nodes 3 years ago
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
3 years ago
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
3 years ago
Jeff Becker d88ed4eee0
make windows happy by making some constexprs non static and such as windows does not LTO 3 years ago
Jeff Becker 37ab78b654
dont run router testing if we are decommissioned.
properly name function to be called LooksDecommissioned because that is different than deregistered
3 years ago
Jeff Becker 07d18b30c0
typofix 3 years ago
Jason Rhinelander 7c964800ba
Fix unintentional whitelist/greylist copying 3 years ago
Jeff Becker ef924aea39
gossip RC when we are not deregistered so we can come back when we are decommissioned 3 years ago
Jeff Becker 95537804cd
separate white/grey list for active/decommissioned nodes.
allow sessions to decommissioned nodes but not paths.
3 years ago
Jason Rhinelander 28ba0b7533
Add logging about testing success/fail 3 years ago
Jeff Becker c23e121139
capture by value to appease clang 11 3 years ago
Jeff Becker 9ad90d029d
* use weak_ptr on core rpc
* use reachability testing code lifted storage server's code
3 years ago
Jeff Becker b830eeb535
initial lokinet router testing:
* report via rpc to oxen core connection stats on success and failure
* connect to random service node by pubkey every 5 seconds for testing
3 years ago
Jeff Becker 51b7566a46
if we look deregistered we will now:
* not gossip our rc
* not explore the network to prevent outbound session attempts
* not establish sessions to other service nodes
* close all open sessions we have to tell clients we don't want them
* catch exceptions flushing peerdb in disk thread
* don't connect out to non allowed routers
* simplify logic in RCLookupHandler::RemoteIsAllowed()
* add HaveReceivedWhitelist to I_RCLookupHandler base type
* add LooksDeregistered to Router type that tells us if we think we are deregistered
* don't allow building paths over us if we are deregistered
3 years ago