mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
[client] Fix engine restart (#3435)
- Refactor the network monitoring to handle one event and it after return - In the engine restart cancel the upper layer context and the responsibility of the engine stop will be the upper layer - Before triggering a restart, the engine checks whether the state is already down. This helps avoid unnecessary delayed network restart events.
This commit is contained in:
@@ -2,10 +2,21 @@
|
||||
|
||||
package networkmonitor
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (nw *NetworkMonitor) Start(context.Context, func()) error {
|
||||
return nil
|
||||
type NetworkMonitor struct {
|
||||
}
|
||||
|
||||
// New creates a new network monitor.
|
||||
func New() *NetworkMonitor {
|
||||
return &NetworkMonitor{}
|
||||
}
|
||||
|
||||
func (nw *NetworkMonitor) Listen(_ context.Context) error {
|
||||
return fmt.Errorf("network monitor not supported on mobile platforms")
|
||||
}
|
||||
|
||||
func (nw *NetworkMonitor) Stop() {
|
||||
|
||||
Reference in New Issue
Block a user