Here I thought I was some rust hotshot but then I need to share a mutable value between threads.

`Arc<Option<Mutex<TunnelManager>>>` is one hell of a type. :P

`Mutex<Option<TunnelManager>>`

is a lot more reasonable. :P

```
{
let mut tunnels1 = tunnels1.lock().await.unwrap();
tunnels1.open_tunnel(route_id).await?
}
```

Ain't it funky

Coding in rust makes me feel so stupid :P

It seems I need to place the mutex into an arc after all?

@mauve mutexes do tend to need to be placed in arcs to work correctly!

Follow

@yosh I think my issue is that I am trying to reuse it both in a closure and later in some other code.

I think I just need to rewrite this using channels and treat the two simulated peers as fully separate peers + have them listen on incoming events generated from a third thread doing the networking.

· · Web · 0 · 0 · 1
Sign in to participate in the conversation
Mauvestodon

Escape ship from centralized social media run by Mauve.