mirror of https://github.com/cbeuw/Cloak
Randomise echo test data
This commit is contained in:
parent
8fbb2dd8cc
commit
f322f8b47f
|
|
@ -65,14 +65,15 @@ func makeSessionPair(numConn int) (*Session, *Session, []*connPair) {
|
||||||
|
|
||||||
func runEchoTest(t *testing.T, conns []net.Conn, msgLen int) {
|
func runEchoTest(t *testing.T, conns []net.Conn, msgLen int) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
testData := make([]byte, msgLen)
|
|
||||||
rand.Read(testData)
|
|
||||||
|
|
||||||
for _, conn := range conns {
|
for _, conn := range conns {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(conn net.Conn) {
|
go func(conn net.Conn) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
|
testData := make([]byte, msgLen)
|
||||||
|
rand.Read(testData)
|
||||||
|
|
||||||
// we cannot call t.Fatalf in concurrent contexts
|
// we cannot call t.Fatalf in concurrent contexts
|
||||||
n, err := conn.Write(testData)
|
n, err := conn.Write(testData)
|
||||||
if n != msgLen {
|
if n != msgLen {
|
||||||
|
|
|
||||||
|
|
@ -222,14 +222,15 @@ func establishSession(lcc client.LocalConnConfig, rcc client.RemoteConnConfig, a
|
||||||
|
|
||||||
func runEchoTest(t *testing.T, conns []net.Conn, msgLen int) {
|
func runEchoTest(t *testing.T, conns []net.Conn, msgLen int) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
testData := make([]byte, msgLen)
|
|
||||||
rand.Read(testData)
|
|
||||||
|
|
||||||
for _, conn := range conns {
|
for _, conn := range conns {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(conn net.Conn) {
|
go func(conn net.Conn) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
|
testData := make([]byte, msgLen)
|
||||||
|
rand.Read(testData)
|
||||||
|
|
||||||
// we cannot call t.Fatalf in concurrent contexts
|
// we cannot call t.Fatalf in concurrent contexts
|
||||||
n, err := conn.Write(testData)
|
n, err := conn.Write(testData)
|
||||||
if n != msgLen {
|
if n != msgLen {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue