Skip to content

Commit

Permalink
update upload artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
hanneary committed Sep 30, 2024
1 parent b6e58e9 commit 58117e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/vsock-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Compile proxy
run: cargo build -p vsock-proxy --release
- name: Upload proxy
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: vsock-proxy
path: target/release/vsock-proxy
Expand Down
17 changes: 12 additions & 5 deletions shared/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
use tokio::io::ErrorKind;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, Error, ErrorKind};

pub async fn pipe_streams<T1, T2>(mut src: T1, mut dest: T2) -> Result<(u64, u64), tokio::io::Error>
pub async fn pipe_streams<T1, T2>(mut src: T1, mut dest: T2) -> Result<(u64, u64), Error>
where
T1: AsyncRead + AsyncWrite + Unpin,
T2: AsyncRead + AsyncWrite + Unpin,
{
match tokio::io::copy_bidirectional(&mut src, &mut dest).await {
Ok(bytes) => Ok(bytes),
Err(e) if e.kind() == ErrorKind::BrokenPipe => Ok((0, 0)),
Ok(result) => {
let _ = src.shutdown().await;
let _ = dest.shutdown().await;
Ok(result)
}
Err(e) if e.kind() == ErrorKind::BrokenPipe => {
let _ = src.shutdown().await;
let _ = dest.shutdown().await;
Ok((0, 0))
}
Err(e) => Err(e),
}
}
Expand Down

0 comments on commit 58117e8

Please sign in to comment.