Skip to content

Commit

Permalink
fixup! feat: add magicsock opt to block direct endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
deansheather committed Nov 22, 2023
1 parent d8aa41d commit 614a18f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions wgengine/magicsock/magicsock.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ func NewConn(opts Options) (*Conn, error) {
c.logf = opts.logf()
c.epFunc = opts.endpointsFunc()
c.derpActiveFunc = opts.derpActiveFunc()
c.blockEndpoints = opts.BlockEndpoints
c.idleFunc = opts.IdleFunc
c.testOnlyPacketListener = opts.TestOnlyPacketListener
c.noteRecvActivity = opts.NoteRecvActivity
Expand Down
7 changes: 3 additions & 4 deletions wgengine/magicsock/magicsock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3112,14 +3112,13 @@ func TestBlockEndpointsDERPOK(t *testing.T) {
func waitForNoEndpoints(t *testing.T, ms *Conn) {
t.Helper()
ok := false
parentLoop:
for i := 0; i < 50; i++ {
time.Sleep(100 * time.Millisecond)
ms.mu.Lock()
for _, ep := range ms.lastEndpoints {
t.Errorf("endpoint %v was not blocked", ep.Addr)
if len(ms.lastEndpoints) != 0 {
t.Errorf("some endpoints were not blocked: %v", ms.lastEndpoints)
ms.mu.Unlock()
continue parentLoop
continue
}
ms.mu.Unlock()
ok = true
Expand Down

0 comments on commit 614a18f

Please sign in to comment.