Merge pull request #85 from fufesou/fix/fs_flush_before_getting_buf

fix: fs, flush before getting the buf
This commit is contained in:
RustDesk 2025-03-28 17:35:00 +08:00 committed by GitHub
commit 81b932b7bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -513,10 +513,13 @@ impl TransferJob {
})
}
pub fn get_buf_data(self) -> Option<Vec<u8>> {
pub async fn get_buf_data(self) -> ResultType<Option<Vec<u8>>> {
match self.data_stream {
Some(DataStream::BufStream(bs)) => Some(bs.into_inner().into_inner()),
_ => None,
Some(DataStream::BufStream(mut bs)) => {
bs.flush().await?;
Ok(Some(bs.into_inner().into_inner()))
}
_ => Ok(None),
}
}