Commit Graph

147 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
Jeff 1eba0f836e
replace LLARP_PROTO_VERSION macro 2 years ago
Jeff a61e9636b2
state machine fix for link layer
if a pending inbound session did not complete a handshake after an unclean close from a previous session the
remote udp endpoint would remain stuck mapped as authed and thus any further attempts from the remote would
be silently dropped as it entered a stuck state in the state machine. this was happening as a small part
of the state machine was hidden in the implementation details of iwp, but instead should be in the super type
as it is logic exclusively outside the details which every dialect would have regardless of its details.

this commit will unmap the udp endpoint every time it needs to in the link layer state machine, independat of
the implementation details of the diact.
2 years ago
majestrate 238c33f565
Update llarp/iwp/session.cpp
return

Co-authored-by: Thomas Winget <tewinget@gmail.com>
2 years ago
Jeff 26c8063fc9
convert priority queues 2 years ago
Jeff 8960ca08f3
propagate link layer message priority to link layer so it can order retransmissions with that in mind 2 years ago
Jason Rhinelander b09298e211
Replace llarp/util/endian.hpp with oxenc/endian.h 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
Jason Rhinelander d02558350a
Crank oxen-mq to (1.2.)11; switch to oxen-encoding
- Update oxen-mq submodule to latest stable
- Add oxen-encoding submodule
- Convert all oxenmq encoding usage to oxenc
- Modernize cmake handling of oxenmq/oxenc
2 years ago
Jeff Becker ec8d990163
demote log statement levels 3 years ago
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.
3 years ago
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.
3 years ago
Jason Rhinelander 78cc466bf2 Rename PumpLL -> TriggerPump
And rename the actual pump implementation back to PumpLL.
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 362fda5a56 Combine empty + pop into single call 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 50449038b4 Another gcc-11 fix
GCC is wrongly warning that `h` is uninitialized here, but it clearly
isn't.  Work around it.
3 years ago
Jeff Becker 20bc338eba
inbound sessions from CLIENTS should only have an elevated lifetime 3 years ago
Jeff Becker caddeef2e8
more information in logs 3 years ago
Jeff Becker 1aa2146b4a
for inbound sessions, keep them alive for the default session lifetime, for outbound sessions keep alive for 5 ping intervals 3 years ago
Jeff Becker e058b873b6
Revert "tweak timeout parameters for link layer."
This reverts commit eef192b37aec070d624e84cedfc94f522fd0a346.
3 years ago
Jeff Becker 657c39a91c
tweak timeout parameters for link layer.
have different timeouts for service node vs client
3 years ago
Jeff Becker e005b34169
fix up some retarded bullshit
* llarp::service::NameIsValid was not checking that the tld was .loki, add this check.
* make link layer initial connection timeout 5s not the session activity timeout which happens to be 60 god damn seconds.
3 years ago
Jeff Becker 5b05d22bad
refactors
* add path sequence numbers on routing messages
* reduce log level in debug mode
* wire up loopback style sending to ourself
3 years ago
Jeff Becker 7a1ffc2df4
* lessen replay filter window
* dont have transit hops use a replay filter
* formatting
3 years ago
Jeff Becker 9c742b36eb
call delivery status hook on overload 3 years ago
Thomas Winget 7caa87862e standardize include format and pragma once
All #ifndef guards on headers have been removed, I think,
in favor of #pragma once

Headers are now included as `#include "filename"` if the included file
resides in the same directory as the file including it, or any
subdirectory therein.  Otherwise they are included as
`#include <project/top/dir/relative/path/filename>`

The above does not include system/os headers.
3 years ago
Jason Rhinelander 91d6698a9d Reformat with clang-format-11 3 years ago
Jeff Becker 7dbd25f271
don't leave old multi ack codepath in 3 years ago
Jeff Becker ad3c23ba2b
simplify call 3 years ago
Jeff Becker 5cffc3b0f8
consolidate rx message handling in iwp
* add toggle flag for using multi ack
* check replay filter before processing message
3 years ago
Jeff Becker 74f707ee01
only do single ack packets 3 years ago
Jeff Becker 1c3020a05e
drop on overload 3 years ago
Jeff Becker bb9bd25059
get rid of use of llarp::IpAddress from hotpaths 3 years ago
Jeff Becker 42ffbcca0a
try coleasing inbound packets from iwp 3 years ago
Jeff 28bfaf0372
ammend log levels for common spammy log events (#1375) 4 years ago
Stephen Shelton b2a72dd46a
Initial test_peer_stats hive test 4 years ago
Stephen Shelton d897099e1d
Track traffic peerstats 4 years ago
Jeff Becker f4971a88fd
use lokimq workers instead of llarp:🧵:ThreadPool 4 years ago
Stephen Shelton 91a2af0eda
Sanity checks around shared_from_this() 4 years ago
Jeff Becker 44c790b65c
revert back to for loop for simplicity 4 years ago
Jeff Becker db00d080f6
use std::list instead of std::vector because idfk man 4 years ago
Jeff Becker 96cbab33c3
style: put iterator erase in for loop update 4 years ago
Jeff Becker 44ff3a9928
copy assignment so we don't crash 4 years ago
Jeff Becker 149a01c80f
dont use std::bind, use lambda 4 years ago
Jeff Becker 3a776b3ed1
bounds checks and such 4 years ago
Jeff Becker 3eb006f78c
iwp/libuv cleanup: remove llarp_pkt_list and all users of it as it's broke 4 years ago
Jeff Becker e56faba23d
make format 4 years ago
Jason Rhinelander dccc663f31 Miss Match demands her name be removed from the code
(i.e. fix speeling mistack: missmatch -> mismatch)
4 years ago
Stephen Shelton aee96e53a3
Refactor Addr -> IpAddress/SockAddr 4 years ago