lightningdevkit / ldk-node

A ready-to-go node implementation built using LDK.
Other
140 stars 72 forks source link

Improve connection management #266

Closed tnull closed 4 months ago

tnull commented 6 months ago

Based on #243. Based on #244.

As a pre-factor to #256, we clean up our connection handling. Namely, we move it to a new connection.rs file and clean up the logic a bit, allowing us to drop the dependency on the futures crate.

Then, we introduce a ConnectionManager that handles pending connection attempts. Previously, concurrent calls to do_connect_peer/connect_peer_if_necessary could result in multiple connections being opened, just to be closed as redundant shortly after. Here, we fix this behavior by ensuring only one connection attempt is inflight at any given point in time.

tnull commented 6 months ago

Rebased after #272 was merged to resolve minor conflicts.

tnull commented 4 months ago

Rebased on #244.

tnull commented 4 months ago

Rebased on main and squashed fixups without further changes.