]> git.bitcoin.ninja Git - ldk-sample/commitdiff
Fix inbound connections by using tokio net instead of std
authorMatt Corallo <git@bluematt.me>
Tue, 4 May 2021 19:42:02 +0000 (19:42 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 4 May 2021 20:02:17 +0000 (20:02 +0000)
src/main.rs

index 33e5eb5733d30c151bb97adf1260709d593f1b57..bf0e24e9051ed6e8d75568f589d0da9fbd3f5570 100644 (file)
@@ -482,13 +482,13 @@ async fn start_ldk() {
        let event_notifier = event_ntfn_sender.clone();
        let listening_port = args.ldk_peer_listening_port;
        tokio::spawn(async move {
-               let listener = std::net::TcpListener::bind(format!("0.0.0.0:{}", listening_port)).unwrap();
+               let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", listening_port)).await.unwrap();
                loop {
                        let peer_mgr = peer_manager_connection_handler.clone();
                        let notifier = event_notifier.clone();
-                       let tcp_stream = listener.accept().unwrap().0;
+                       let tcp_stream = listener.accept().await.unwrap().0;
                        tokio::spawn(async move {
-                               lightning_net_tokio::setup_inbound(peer_mgr.clone(), notifier.clone(), tcp_stream)
+                               lightning_net_tokio::setup_inbound(peer_mgr.clone(), notifier.clone(), tcp_stream.into_std().unwrap())
                                        .await;
                        });
                }