agent,runtime-rs: fix container io detach and attach

Partially fix some issues related to container io detach and attach.

Fixes: #6714
Signed-off-by: Zixuan Tan <tanzixuan.me@gmail.com>
This commit is contained in:
Zixuan Tan
2023-10-30 01:21:32 +08:00
parent 657b17a86f
commit 5536743361
5 changed files with 75 additions and 75 deletions

View File

@@ -337,15 +337,12 @@ impl Process {
/// Close the stdin of the process in container.
pub async fn close_io(&mut self, agent: Arc<dyn Agent>) {
if self.passfd_io.is_some() {
// In passfd io mode, if containerd closes stdin stream, the
// agent can get the close event from the vsock connection.
// so we just return here.
return;
// In passfd io mode, the stdin close and sync logic is handled
// in the agent side.
if self.passfd_io.is_none() {
self.wg_stdin.wait().await;
}
self.wg_stdin.wait().await;
let req = agent::CloseStdinRequest {
process_id: self.process.clone().into(),
};