derp, wgengine/magicsock: support more than just packets from Client.Recv

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2020-02-20 19:10:54 -08:00
committed by Brad Fitzpatrick
parent 88f1cc0c98
commit 379a3125fd
7 changed files with 63 additions and 27 deletions
+8 -3
View File
@@ -94,13 +94,18 @@ func TestSendRecv(t *testing.T) {
default:
}
b := make([]byte, 1<<16)
n, err := c.Recv(b)
m, err := c.Recv(b)
if err != nil {
t.Logf("client%d: %v", i, err)
break
}
b = b[:n]
recvChs[i] <- b
switch m := m.(type) {
default:
t.Errorf("unexpected message type %T", m)
continue
case derp.ReceivedPacket:
recvChs[i] <- []byte(m)
}
}
}(i)
}