Skip to content

Commit 11b7eb5

Browse files
committed
Use cancellable task for inbound connections
So that we'll cleanly signal and wait for termination.
1 parent 09eacfa commit 11b7eb5

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
@@ -313,6 +313,7 @@ impl Node {
313313
bind_addrs.extend(resolved_address);
314314
}
315315

316+
let runtime = Arc::clone(&self.runtime);
316317
self.runtime.spawn_cancellable_background_task(async move {
317318
{
318319
let listener =
@@ -338,7 +339,7 @@ impl Node {
338339
}
339340
res = listener.accept() => {
340341
let tcp_stream = res.unwrap().0;
341-
tokio::spawn(async move {
342+
runtime.spawn_cancellable_background_task(async move {
342343
lightning_net_tokio::setup_inbound(
343344
Arc::clone(&peer_mgr),
344345
tcp_stream.into_std().unwrap(),

0 commit comments

Comments
 (0)