Commit Graph

52 Commits

Author SHA1 Message Date
lunar-mining
736459aa51 chore: cleanup
fix warnings + debug statements
2024-01-10 08:49:29 +01:00
lunar-mining
96cad54d81 net: 99.9999% of the time it works 100% of the time
cleaned up refinery code and seem to have eliminated deadlocks...
2024-01-08 12:20:10 +01:00
aggstam
cdaddfbfe2 event_graph: introduce layers to the DAG
Each event corresponds to a specific layer(height) in the dag, making identifying and preventing cycles way easier, as all parents must exist in previous layers. Additionally, propagation and sync gremlins have been eliminated, and proper validations added
2023-12-14 11:45:32 +01:00
parazyd
0e58326b57 rpc/server: Add a few debugging messages to be able to trace bg tasks 2023-11-11 16:26:38 +01:00
narodnik
f3c604acc1 system/condvar: add illustrative comments to explain how async/await works in rust 2023-09-08 13:58:56 +02:00
x
e46454edcb channel, centralize stop() logic in handle_stop() 2023-09-04 11:09:22 +02:00
aggstam
be4da84140 chore: clippy 2023-08-31 16:18:44 +03:00
x
daca803280 sys: improve docstring for CondVar 2023-08-31 13:15:04 +02:00
x
902ec7bbf1 system: add unit tests for CondVar and StoppableTask like a good boi 2023-08-31 13:03:13 +02:00
x
2c94dfdfa9 StoppableTask: use CondVar instead of channels, add logs and make impl more robust 2023-08-31 09:44:13 +02:00
parazyd
59486b5392 system/stoppable_task: Implement Hash for StoppableTask and add an id field. 2023-08-31 01:18:45 +02:00
x
e481bd8bae add Error::SeedFailed 2023-08-30 10:33:01 +02:00
x
4cf9878604 net: fix the Option.unwrap() bug. Adding debug info, we see:
16:14:42 [DEBUG] (2) net::channel::stop(): END => address=tcp+tls://lilith1.dark.fi:5262 remote=485041065
    16:14:42 [DEBUG] (2) net::p2p::seed(): P2P::seed() [END]
    16:14:42 [DEBUG] (2) net::channel::main_receive_loop(): dnet sending recv msg, remote 485041065
    thread '<unnamed>' panicked at src/net/channel.rs:314:32:
    called `Option::unwrap()` on a `None` value

So the bug is caused after running p2p.seed(), where after
channel.stop() is called, main_receive_loop() keeps running. Examining
the code further we see ch.stop().await is called and the session is
destroyed but this doesn't give enough time for the channel to finish.

One solution is to modify `net/session/seedsync_session.rs` to this:

    let stop_sub = ch.subscribe_stop().await;
    ch.stop().await;
    stop_sub.recv().await;
    stop_sub.unsubscribe().await;

However a better solution is to make channel.stop() itself await until
the channel is fully closed (using the above code inside Channel::stop())

But the better solution is to ensure that StoppableTask.stop() itself
will not finish until the task it's responsible for has finished and
is no longer running. We do that by adding a stop barrier (see diff).
2023-08-30 10:19:52 +02:00
x
adedcdbaaa Revert "net/acceptor: replace Mutex<Option<Weak<Session>>> with LazyWeak<Session>"
This reverts commit 34fc8fbd8f.
2023-08-28 14:15:09 +02:00
x
34fc8fbd8f net/acceptor: replace Mutex<Option<Weak<Session>>> with LazyWeak<Session> 2023-08-28 13:49:31 +02:00
parazyd
44b8cd022a system/lazy_weak: Fix rustdoc 2023-08-25 19:36:31 +02:00
parazyd
2b7dd67309 chore: Clippy lints and compile fixes. 2023-08-25 19:28:08 +02:00
x
1e752bfb7e net: add peer discovery connection strategy 2023-08-25 17:05:21 +02:00
parazyd
9ed979454c chore: Add license headers to new .rs files. 2023-08-25 16:56:12 +02:00
x
324024b83e system/net: introduce LazyWeak which simplifies parent-child hierarchies 2023-08-25 15:17:58 +02:00
x
dce54b61c3 net/outbound_session: add PeerDiscovery process to OutboundSession. Slots and PeerDiscovery communicate through CondVar 2023-08-25 14:50:38 +02:00
x
61b35c2b79 system: add CondVar 2023-08-25 10:47:10 +02:00
x
d4ba515f7d net: remove p2p.run(), now we simply call p2p.start() and p2p.stop() 2023-08-24 11:00:58 +02:00
x
4c94fa251c add docstring for StoppableTask 2023-08-22 15:19:50 +02:00
parazyd
0f125fa2db net: Remove async-std dependency and prefer smol.
Also we now take the global executor and keep it around in P2p.
2023-08-22 15:07:48 +02:00
parazyd
557dfd0bb5 system: Implement async timeout helpers.
This is copied from async-std, under the MIT license.
2023-08-22 15:04:47 +02:00
parazyd
a0b73961fb system: Use a bounded channel for StoppableTask. 2023-08-22 09:49:13 +02:00
parazyd
f782c236a4 system: Fully port to smol runtime. 2023-08-22 09:38:22 +02:00
parazyd
cf002a03b0 system/subscriber: Change SubscriptionId type to usize. 2023-08-20 18:53:52 +02:00
parazyd
78c4180c90 net: Improve log message. 2023-08-10 17:23:57 +02:00
parazyd
98ef7c834e chore: Update project dependencies. 2023-07-08 20:17:47 +02:00
parazyd
55ee919906 net: Perform full p2p code cleanup and improve certain pieces.
Notable changes:

* Rewritten transport protocols into Dialer and Listener (Nym is TODO)

  This simplifies using the transports a lot, as can be seen for example
  in src/rpc, and generally around the p2p library. It also defines features
  for each transport (all of which are enabled by default). We drop the
  socks client for Tor and Nym and use first-class support with the Arti Tor
  library, and nym-sphinx/nym-websockets (to be used with nym-client).

* Outbound session healing

  The outbound session will now poll and try to fill all the requested
  slots more efficiently, and if needed, will activate peer discovery to
  find more peers if we can't connect to any known ones. Also if we're
  unable to connect to any, we shall drop them from our set.

  Additionally, transport mixing is enabled by default, so when we're
  allowing transport mixing, and we use Tor, we will also be able to connect
  to other transports that Tor can connect to (e.g. tcp://).

* Unix socket transport dropped

  We haven't been using this, and it seems we're not going down this path,
  so the code has been obsoleted and removed.

* TLS session verification

  We fully verify server and client TLS certificates upon connection so
  we're able to perform TLS1.3 with forward secrecy.

* lilith pruning

  lilith now periodically prunes known peers from its sets if it's unable
  to connect to them.
2023-06-29 13:13:15 +02:00
x
5702976798 cleanup logging project wide 2023-01-02 14:47:55 +01:00
parazyd
71cd3064d6 Update license year. 2022-12-28 13:06:00 +01:00
parazyd
88caee7f42 Update and clean up dependencies. 2022-12-13 15:19:09 +01:00
parazyd
5da9a72eae darkfid/consensus: Export finalized blocks notifications. 2022-11-25 14:38:20 +01:00
parazyd
8ae84ad7f9 Add license header to source files. 2022-10-31 18:16:13 +01:00
Luther Blissett
2b587bc14a Migrate lib to smol instead of explicit async deps.
Internally they're the same, smol exports them.
2022-10-14 18:43:26 +02:00
ghassmo
cd200f8be4 src/system: remove notify_by_id function from subscriber 2022-09-06 13:35:43 +04:00
ghassmo
e5bde0c6d1 system/subscriber: use warn msg instead of panic once notify call failed 2022-06-28 01:50:47 +03:00
ghassmo
06db050229 bin/ircd: send messages in buffer to the client after JOIN command 2022-06-28 01:43:53 +03:00
ghassmo
789bbf93c6 system/subscriber: add notify_with_exclude function to Subscriber 2022-06-25 16:02:30 +03:00
ghassmo
bf946b3876 system: add self_notify function to Subscription 2022-06-25 16:02:30 +03:00
ghassmo
937e06ec4f Replace HashMap with FxHashMap 2022-03-18 23:19:13 +04:00
parazyd
7276498e64 cargo fmt with new settings. 2021-11-27 17:02:29 +01:00
parazyd
340631df2d Code linting.
For best and standard practices in Rust, acronyms should be CamelCase,
and capitalization should be avoided; i.e. ZKCircuit -> ZkCircuit

This commit replaces all such occurencies in the codebase.
2021-07-16 11:25:56 +02:00
rachel-rose
44c93a8faa made random function private 2021-04-03 10:45:58 +02:00
narodnik
6bb1f7fb28 add p2p::subscribe_channel() and improve subscriber semantics. 2021-03-07 09:35:52 +01:00
narodnik
2dca8127fb cargo fmt and fix 2021-01-25 17:13:47 +01:00
narodnik
bd2353620e Start to better define the protocol subsystem through ProtocolJobsManager 2021-01-25 17:02:45 +01:00