mirror of
https://github.com/fosrl/newt.git
synced 2026-02-28 15:56:40 +00:00
Make sure to call stop function inside of clients
This commit is contained in:
4
main.go
4
main.go
@@ -1199,6 +1199,10 @@ persistent_keepalive_interval=5`, fixKey(privateKey.String()), fixKey(wgData.Pub
|
|||||||
logger.Info("Websocket connected")
|
logger.Info("Websocket connected")
|
||||||
|
|
||||||
if !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
|
// 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)
|
stopFunc = client.SendMessageInterval("newt/ping/request", map[string]interface{}{}, 3*time.Second)
|
||||||
logger.Info("Requesting exit nodes from server")
|
logger.Info("Requesting exit nodes from server")
|
||||||
|
|||||||
@@ -399,6 +399,10 @@ func (s *WireGuardService) SetOnNetstackClose(callback func()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *WireGuardService) LoadRemoteConfig() error {
|
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{}{
|
s.stopGetConfig = s.client.SendMessageInterval("newt/wg/get-config", map[string]interface{}{
|
||||||
"publicKey": s.key.PublicKey().String(),
|
"publicKey": s.key.PublicKey().String(),
|
||||||
"port": s.Port,
|
"port": s.Port,
|
||||||
|
|||||||
Reference in New Issue
Block a user