You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a program where I can add and remove devices during execution. But I find this to be difficult to do in a safe manner for several reasons:
The handler function is private, so I'm not able to create my own server loop.
The server function spawns threads for each socket without keeping track of them, so it's not trivial to close the threads when removing a usb from the vector. (I haven't found any way to do graceful shutdown in the protocol spec)
I had imagined to create something like the following:
/// Spawn a USB/IP server at `addr` using [TcpListener]pubasyncfncustomServer(addr:SocketAddr,server:UsbIpServer){let listener = TcpListener::bind(addr).await.expect("bind to addr");let server = asyncmove{let usbip_server = Arc::new(server);loop{
tokio::select! {
val = listener.accept() => {match val {Ok((mut socket, _addr)) => {
...
}Err(err) => {
...
}}}
val = listen_for_devicelist_changes() => {// add or remove device
...
}}}};
server.await}
Is this something you would consider to be in the scope of the library?
The text was updated successfully, but these errors were encountered:
Hello!
I'm trying to create a program where I can add and remove devices during execution. But I find this to be difficult to do in a safe manner for several reasons:
handler
function is private, so I'm not able to create my own server loop.server
function spawns threads for each socket without keeping track of them, so it's not trivial to close the threads when removing a usb from the vector. (I haven't found any way to do graceful shutdown in the protocol spec)I had imagined to create something like the following:
Is this something you would consider to be in the scope of the library?
The text was updated successfully, but these errors were encountered: