Make sure to call stop function inside of clients

Former-commit-id: 502ebfc362
This commit is contained in:
Owen
2025-09-01 15:45:23 -07:00
parent 63e924a46b
commit c6f94945b8
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -1199,6 +1199,10 @@ persistent_keepalive_interval=5`, fixKey(privateKey.String()), fixKey(wgData.Pub
logger.Info("Websocket connected")
if !connected {
// make sure the stop function is called
if stopFunc != nil {
stopFunc()
}
// request from the server the list of nodes to ping at newt/ping/request
stopFunc = client.SendMessageInterval("newt/ping/request", map[string]interface{}{}, 3*time.Second)
logger.Info("Requesting exit nodes from server")
+4
View File
@@ -399,6 +399,10 @@ func (s *WireGuardService) SetOnNetstackClose(callback func()) {
}
func (s *WireGuardService) LoadRemoteConfig() error {
if s.stopGetConfig != nil {
s.stopGetConfig()
s.stopGetConfig = nil
}
s.stopGetConfig = s.client.SendMessageInterval("newt/wg/get-config", map[string]interface{}{
"publicKey": s.key.PublicKey().String(),
"port": s.Port,