diff --git a/app/proxyman/mux/mux_test.go b/app/proxyman/mux/mux_test.go index c8508dc26..0bbd1202b 100644 --- a/app/proxyman/mux/mux_test.go +++ b/app/proxyman/mux/mux_test.go @@ -30,7 +30,7 @@ func readAll(reader buf.Reader) (buf.MultiBuffer, error) { func TestReaderWriter(t *testing.T) { assert := With(t) - pReader, pWriter := pipe.New() + pReader, pWriter := pipe.New(pipe.WithSizeLimit(1024)) dest := net.TCPDestination(net.DomainAddress("v2ray.com"), 80) writer := NewWriter(1, dest, pWriter, protocol.TransferTypeStream) diff --git a/common/buf/reader_test.go b/common/buf/reader_test.go index f5ea1e104..347985b56 100644 --- a/common/buf/reader_test.go +++ b/common/buf/reader_test.go @@ -38,7 +38,7 @@ func TestAdaptiveReader(t *testing.T) { func TestBytesReaderWriteTo(t *testing.T) { assert := With(t) - pReader, pWriter := pipe.New() + pReader, pWriter := pipe.New(pipe.WithSizeLimit(1024)) reader := &BufferedReader{Reader: pReader} b1 := New() b1.AppendBytes('a', 'b', 'c') @@ -47,7 +47,7 @@ func TestBytesReaderWriteTo(t *testing.T) { assert(pWriter.WriteMultiBuffer(NewMultiBufferValue(b1, b2)), IsNil) pWriter.Close() - pReader2, pWriter2 := pipe.New() + pReader2, pWriter2 := pipe.New(pipe.WithSizeLimit(1024)) writer := NewBufferedWriter(pWriter2) writer.SetBuffered(false) @@ -65,7 +65,7 @@ func TestBytesReaderWriteTo(t *testing.T) { func TestBytesReaderMultiBuffer(t *testing.T) { assert := With(t) - pReader, pWriter := pipe.New() + pReader, pWriter := pipe.New(pipe.WithSizeLimit(1024)) reader := &BufferedReader{Reader: pReader} b1 := New() b1.AppendBytes('a', 'b', 'c') diff --git a/common/buf/writer_test.go b/common/buf/writer_test.go index dbd324abc..09b01559f 100644 --- a/common/buf/writer_test.go +++ b/common/buf/writer_test.go @@ -34,8 +34,8 @@ func TestWriter(t *testing.T) { func TestBytesWriterReadFrom(t *testing.T) { assert := With(t) - pReader, pWriter := pipe.New() const size = 50000 + pReader, pWriter := pipe.New(pipe.WithSizeLimit(size)) reader := bufio.NewReader(io.LimitReader(rand.Reader, size)) writer := NewBufferedWriter(pWriter) writer.SetBuffered(false) diff --git a/transport/internet/udp/dispatcher_test.go b/transport/internet/udp/dispatcher_test.go index 4d3323429..f7a93bd09 100644 --- a/transport/internet/udp/dispatcher_test.go +++ b/transport/internet/udp/dispatcher_test.go @@ -34,8 +34,8 @@ func TestSameDestinationDispatching(t *testing.T) { assert := With(t) ctx, cancel := context.WithCancel(context.Background()) - uplinkReader, uplinkWriter := pipe.New() - downlinkReader, downlinkWriter := pipe.New() + uplinkReader, uplinkWriter := pipe.New(pipe.WithSizeLimit(1024)) + downlinkReader, downlinkWriter := pipe.New(pipe.WithSizeLimit(1024)) go func() { for { diff --git a/transport/pipe/pipe_test.go b/transport/pipe/pipe_test.go index 10063ba1e..5a823c779 100644 --- a/transport/pipe/pipe_test.go +++ b/transport/pipe/pipe_test.go @@ -15,7 +15,7 @@ import ( func TestPipeReadWrite(t *testing.T) { assert := With(t) - pReader, pWriter := New() + pReader, pWriter := New(WithSizeLimit(1024)) payload := []byte{'a', 'b', 'c', 'd'} b := buf.New() b.Write(payload) @@ -29,7 +29,7 @@ func TestPipeReadWrite(t *testing.T) { func TestPipeCloseError(t *testing.T) { assert := With(t) - pReader, pWriter := New() + pReader, pWriter := New(WithSizeLimit(1024)) payload := []byte{'a', 'b', 'c', 'd'} b := buf.New() b.Write(payload) @@ -44,7 +44,7 @@ func TestPipeCloseError(t *testing.T) { func TestPipeClose(t *testing.T) { assert := With(t) - pReader, pWriter := New() + pReader, pWriter := New(WithSizeLimit(1024)) payload := []byte{'a', 'b', 'c', 'd'} b := buf.New() b.Write(payload)