Skip to content

Commit

Permalink
improve error handling of tcp proxy.
Browse files Browse the repository at this point in the history
  • Loading branch information
LindaSummer committed Dec 12, 2024
1 parent f5abeb8 commit 676d5fe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/gocase/util/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,17 @@ func SimpleTCPProxy(ctx context.Context, t testing.TB, to string, slowdown bool)
time.Sleep(time.Millisecond * 100)
}
n, err := src.Read(buffer)
if err != nil && !errors.Is(err, io.EOF) {
if err != nil {
if errors.Is(err, io.EOF) {
break COPY_LOOP
}
return err
}
_, err = dest.Write(buffer[:n])
if err != nil && !errors.Is(err, io.EOF) {
if err != nil {
if errors.Is(err, io.EOF) {
break COPY_LOOP
}
return err
}
}
Expand Down

0 comments on commit 676d5fe

Please sign in to comment.