|
|
@ -7,6 +7,7 @@ import (
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"golang.org/x/sync/errgroup"
|
|
|
|
"v2ray.com/core/common"
|
|
|
|
"v2ray.com/core/common"
|
|
|
|
. "v2ray.com/core/common/buf"
|
|
|
|
. "v2ray.com/core/common/buf"
|
|
|
|
"v2ray.com/core/common/compare"
|
|
|
|
"v2ray.com/core/common/compare"
|
|
|
@ -31,12 +32,17 @@ func TestReadvReader(t *testing.T) {
|
|
|
|
data := make([]byte, 8192)
|
|
|
|
data := make([]byte, 8192)
|
|
|
|
common.Must2(rand.Read(data))
|
|
|
|
common.Must2(rand.Read(data))
|
|
|
|
|
|
|
|
|
|
|
|
go func() {
|
|
|
|
var errg errgroup.Group
|
|
|
|
|
|
|
|
errg.Go(func() error {
|
|
|
|
writer := NewWriter(conn)
|
|
|
|
writer := NewWriter(conn)
|
|
|
|
mb := MergeBytes(nil, data)
|
|
|
|
mb := MergeBytes(nil, data)
|
|
|
|
|
|
|
|
|
|
|
|
if err := writer.WriteMultiBuffer(mb); err != nil {
|
|
|
|
return writer.WriteMultiBuffer(mb)
|
|
|
|
t.Fatal("failed to write data: ", err)
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
|
|
|
|
if err := errg.Wait(); err != nil {
|
|
|
|
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|