Skip to content

Commit

Permalink
clash: remove IsRunning()
Browse files Browse the repository at this point in the history
  • Loading branch information
wongsyrone committed Aug 21, 2021
1 parent e48c36f commit 69fdff8
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions clash/clash.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"
"path/filepath"
"strconv"
"sync/atomic"

"github.com/Dreamacro/clash/config"
C "github.com/Dreamacro/clash/constant"
Expand All @@ -18,10 +17,6 @@ import (
log "github.com/sirupsen/logrus"
)

var (
runningFlag atomic.Value
)

type ClashStartOptions struct {
// HomeDir Clash config home directory
HomeDir string
Expand Down Expand Up @@ -51,15 +46,9 @@ func Start(opt *ClashStartOptions) {
}

ApplyRawConfig(opt)
runningFlag.Store(true)
return
}

func IsRunning() bool {
run := runningFlag.Load()
return run.(bool)
}

func Stop() {
snapshot := statistic.DefaultManager.Snapshot()
for _, c := range snapshot.Connections {
Expand All @@ -75,8 +64,6 @@ func Stop() {
TrojanProxyServerUdpEnabled: true,
}
ApplyRawConfig(opt)

runningFlag.Store(false)
}

func ApplyRawConfig(opt *ClashStartOptions) {
Expand Down Expand Up @@ -151,8 +138,3 @@ func readConfig(path string) ([]byte, error) {

return data, err
}

func init() {
// default value
runningFlag.Store(false)
}

0 comments on commit 69fdff8

Please # to comment.