derp/derphttp: add a context and infoLogger option to RunWatchConnectionLoop

This commit is contained in:
Brad Fitzpatrick
2021-02-12 10:58:43 -08:00
parent 1632f9fd6b
commit 741d654aa3
2 changed files with 30 additions and 9 deletions

View File

@@ -5,6 +5,7 @@
package main
import (
"context"
"errors"
"fmt"
"log"
@@ -40,6 +41,6 @@ func startMeshWithHost(s *derp.Server, host string) error {
c.MeshKey = s.MeshKey()
add := func(k key.Public) { s.AddPacketForwarder(k, c) }
remove := func(k key.Public) { s.RemovePacketForwarder(k, c) }
go c.RunWatchConnectionLoop(s.PublicKey(), add, remove)
go c.RunWatchConnectionLoop(context.Background(), s.PublicKey(), logf, add, remove)
return nil
}