refactor: refactor code (#373)

This commit is contained in:
naison
2024-11-22 22:00:50 +08:00
committed by GitHub
parent 880f842203
commit 98c22ba9b7
18 changed files with 172 additions and 166 deletions

View File

@@ -263,10 +263,7 @@ func copyStream(ctx context.Context, local net.Conn, remote net.Conn) {
if err != nil && !errors.Is(err, net.ErrClosed) && !errors.Is(err, io.EOF) {
log.Debugf("Failed to copy remote -> local: %s", err)
}
select {
case chDone <- true:
default:
}
pkgutil.SafeWrite(chDone, true)
}()
// start local -> remote data transfer
@@ -277,10 +274,7 @@ func copyStream(ctx context.Context, local net.Conn, remote net.Conn) {
if err != nil && !errors.Is(err, net.ErrClosed) && !errors.Is(err, io.EOF) {
log.Debugf("Failed to copy local -> remote: %s", err)
}
select {
case chDone <- true:
default:
}
pkgutil.SafeWrite(chDone, true)
}()
select {