refactor: restructure PTP client to use thread-safe runtime and RNG

Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
Chaos Rogers 2025-07-10 18:54:20 +01:00
parent d6ca055170
commit 7b4deb1cf8
2 changed files with 10 additions and 7 deletions

View file

@ -67,13 +67,15 @@ async fn main() {
});
}
// 5⃣ Spawn PTP client task
// 5⃣ Spawn PTP client thread (blocking, not async)
{
let ptp_state = ltc_state.clone();
let config_clone = config_arc.clone();
tokio::spawn(async move {
println!("🚀 PTP task launched");
start_ptp_client(ptp_state, config_clone).await;
thread::spawn(move || {
println!("🚀 PTP thread launched");
// Create a new tokio runtime for this thread
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(start_ptp_client(ptp_state, config_clone));
});
}