Skip to content

Cannot make the the universal-connectivity work (rust, WIndows) #6050

Answered by drHuangMHT
Uomocosa asked this question in Q&A
Discussion options

You must be logged in to vote

Did you see your Peer ID printed? Like My Peer ID: 12D3KooWDFfq1z9RCUrFmSWhchK8UQDNSznMJhPLBiqPtFQu8QzL. I think your code has some problems.

    #[cfg(windows)]
    { 
         use tokio::signal::windows::{ctrl_c, ctrl_break, ctrl_close, ctrl_logoff, ctrl_shutdown};
            let mut ctrl_c_signal = ctrl_c()?;     // parent `Headless:run()` will pause here to wait for the signal CTRL_C
            // wait for other signals
            // After all signals being captured, spawn the task.
            // task spawning omitted
    }
    // After all signals captured, proceed to main loop

Which means the signal will only be captured once before entering main loop, not during execution. It …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Uomocosa
Comment options

Answer selected by jxs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants