Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
update gorilla lib version, add lazyInit
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Mar 20, 2020
1 parent 3fadf86 commit 34fdfd1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
1 change: 0 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ builds:
-
goos:
- linux
- windows
goarch:
- amd64
- arm
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ require (
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/handlers v1.4.0
github.com/gorilla/mux v1.6.2
github.com/gorilla/handlers v1.4.2
github.com/gorilla/mux v1.7.4
github.com/gorilla/websocket v1.4.0
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
Expand Down
20 changes: 7 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ const (
apkVersionName = "1.0.4"
)

func init() {
syslog.SetFlags(syslog.Lshortfile | syslog.LstdFlags)
}

// singleFight for http request
// - minicap
// - minitouch
Expand Down Expand Up @@ -418,6 +414,8 @@ func stopSelf() {
}

func init() {
syslog.SetFlags(syslog.Lshortfile | syslog.LstdFlags)

// Set timezone.
//
// Note that Android zoneinfo is stored in /system/usr/share/zoneinfo,
Expand All @@ -443,12 +441,16 @@ func init() {
}
time.Local = time.FixedZone(tz, offset*3600)
}
}

// lazyInit will be called in func:main
func lazyInit() {
// watch rotation and send to rotatinPublisher
go _watchRotation()
if !isMinicapSupported() {
minicapSocketPath = "@minicapagent"
}

if !fileExists("/data/local/tmp/minitouch") {
minitouchSocketPath = "@minitouchagent"
} else if sdk, _ := strconv.Atoi(getCachedProperty("ro.build.version.sdk")); sdk > 28 { // Android Q..
Expand Down Expand Up @@ -566,15 +568,6 @@ func main() {
}
}

// if *fRequirements {
// log.Println("check dependencies")
// if err := installRequirements(); err != nil {
// // panic(err)
// log.Println("requirements not ready:", err)
// return
// }
// }

serverURL := *fServerURL
if serverURL != "" {
if !regexp.MustCompile(`https?://`).MatchString(serverURL) {
Expand Down Expand Up @@ -606,6 +599,7 @@ func main() {
}

fmt.Printf("atx-agent version %s\n", version)
lazyInit()

// show ip
outIp, err := getOutboundIP()
Expand Down

0 comments on commit 34fdfd1

Please sign in to comment.