Skip to content

Commit 2b09f98

Browse files
committed
Use cancellable task for inbound connections
So that we'll cleanly signal and wait for termination.
1 parent 65945f8 commit 2b09f98

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ impl Node {
325325
bind_addrs.extend(resolved_address);
326326
}
327327

328+
let runtime = Arc::clone(&self.runtime);
328329
self.runtime.spawn_cancellable_background_task(async move {
329330
{
330331
let listener =
@@ -350,7 +351,7 @@ impl Node {
350351
}
351352
res = listener.accept() => {
352353
let tcp_stream = res.unwrap().0;
353-
tokio::spawn(async move {
354+
runtime.spawn_cancellable_background_task(async move {
354355
lightning_net_tokio::setup_inbound(
355356
Arc::clone(&peer_mgr),
356357
tcp_stream.into_std().unwrap(),

0 commit comments

Comments
 (0)