Extract run_unix_listener extension method
This commit is contained in:
parent
e4bace1793
commit
71aecea297
2 changed files with 19 additions and 6 deletions
|
|
@ -76,6 +76,18 @@ impl HostedBus {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait SharedHostedBus {
|
||||
async fn run_unix_listener(self, listener: tokio::net::UnixListener);
|
||||
}
|
||||
|
||||
impl SharedHostedBus for Arc<tokio::sync::Mutex<HostedBus>> {
|
||||
async fn run_unix_listener(self, listener: tokio::net::UnixListener) {
|
||||
while let Ok((socket, _remote_addr)) = listener.accept().await {
|
||||
self.lock().await.connect_unix(socket).await.unwrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct NameOwnerStream {
|
||||
_conn: zbus::Connection,
|
||||
stream: zbus::MessageStream,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue