File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -67,12 +67,28 @@ func TestDERPMesh(t *testing.T) {
67
67
err = secondClient .Connect (context .Background ())
68
68
require .NoError (t , err )
69
69
70
+ closed := make (chan struct {})
71
+ ctx , cancelFunc := context .WithCancel (context .Background ())
72
+ defer cancelFunc ()
70
73
sent := []byte ("hello world" )
71
- err = firstClient .Send (second .Public (), sent )
72
- require .NoError (t , err )
74
+ go func () {
75
+ defer close (closed )
76
+ ticker := time .NewTicker (50 * time .Millisecond )
77
+ for {
78
+ select {
79
+ case <- ctx .Done ():
80
+ return
81
+ case <- ticker .C :
82
+ }
83
+ err = firstClient .Send (second .Public (), sent )
84
+ require .NoError (t , err )
85
+ }
86
+ }()
73
87
74
88
got := recvData (t , secondClient )
75
89
require .Equal (t , sent , got )
90
+ cancelFunc ()
91
+ <- closed
76
92
})
77
93
t .Run ("RemoveAddress" , func (t * testing.T ) {
78
94
// This tests messages passing through multiple DERP servers.
You can’t perform that action at this time.
0 commit comments