cli: allow client process to control singleton process (#177141)

Other connected clients will now print:

```
Connected to an existing tunnel process running on this machine. You can press:

- Ctrl+C to detach
- "x" to stop the tunnel and exit
- "r" to restart the tunnel
```

These are then sent to the server to have that take effect. This is
mostly some refactors in the singleton_server to make the lifecycle work.
This commit is contained in:
Connor Peet
2023-03-14 17:55:28 -07:00
committed by GitHub
parent 994b2d03c0
commit 0e7d14d32d
12 changed files with 266 additions and 133 deletions

View File

@@ -35,6 +35,13 @@ where
}
}
#[async_trait]
impl<T: Clone + Send + Sync> Receivable<T> for Barrier<T> {
async fn recv_msg(&mut self) -> Option<T> {
self.wait().await.ok()
}
}
#[derive(Clone)]
pub struct BarrierOpener<T: Clone>(Arc<watch::Sender<Option<T>>>);