mirror of
https://github.com/netbirdio/netbird.git
synced 2025-08-18 02:50:43 +02:00
Fix stop not cleaning up WireGuard interface (#286)
This commit is contained in:
committed by
GitHub
parent
a15d52b263
commit
2aaeeac7f6
@@ -17,9 +17,7 @@ import (
|
||||
)
|
||||
|
||||
// RunClient with main logic.
|
||||
func RunClient(
|
||||
ctx context.Context, config *Config, stopCh <-chan int, cleanupCh chan<- struct{},
|
||||
) error {
|
||||
func RunClient(ctx context.Context, config *Config) error {
|
||||
backOff := &backoff.ExponentialBackOff{
|
||||
InitialInterval: time.Second,
|
||||
RandomizationFactor: backoff.DefaultRandomizationFactor,
|
||||
@@ -90,10 +88,7 @@ func RunClient(
|
||||
log.Print("Wiretrustee engine started, my IP is: ", peerConfig.Address)
|
||||
state.Set(StatusConnected)
|
||||
|
||||
select {
|
||||
case <-stopCh:
|
||||
case <-ctx.Done():
|
||||
}
|
||||
<-ctx.Done()
|
||||
|
||||
backOff.Reset()
|
||||
|
||||
@@ -114,10 +109,6 @@ func RunClient(
|
||||
return wrapErr(err)
|
||||
}
|
||||
|
||||
go func() {
|
||||
cleanupCh <- struct{}{}
|
||||
}()
|
||||
|
||||
log.Info("stopped Wiretrustee client")
|
||||
|
||||
if _, err := state.Status(); err == ErrResetConnection {
|
||||
@@ -207,4 +198,3 @@ func connectToManagement(ctx context.Context, managementAddr string, ourPrivateK
|
||||
|
||||
return client, loginResp, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user