diff --git a/main.go b/main.go index c916bea..46e8923 100644 --- a/main.go +++ b/main.go @@ -45,8 +45,8 @@ func main() { } if server { - go zsub.StartHttp() - zsub.ServerStart(addr) // 服务进程启动 + go zsub.StartWatch() + zsub.StartServer(addr) // 服务进程启动 } else { cmd.ClientRun(addr) } diff --git a/upx.exe b/upx.exe deleted file mode 100644 index 436082b..0000000 Binary files a/upx.exe and /dev/null differ diff --git a/zsub/monitor.go b/zsub/monitor.go index 1856c51..e87f482 100644 --- a/zsub/monitor.go +++ b/zsub/monitor.go @@ -2,6 +2,7 @@ package zsub import ( "encoding/json" + "log" "net/http" "os" "path" @@ -12,7 +13,7 @@ func init() { } -func StartHttp() { +func StartWatch() { dir, _ := os.Getwd() webDir := path.Join(dir, "/public") @@ -22,7 +23,9 @@ func StartHttp() { http.HandleFunc("/retimer", retimer) http.HandleFunc("/topic/publish", publish) - http.ListenAndServe(":1217", nil) + watchAddr := GetStr("service.zhub.watch", "0.0.0.0:1217") + log.Println("zhub.watch = ", watchAddr) + http.ListenAndServe(watchAddr, nil) } func publish(w http.ResponseWriter, r *http.Request) { diff --git a/zsub/zsub.go b/zsub/zsub.go index dc7a052..e3a0ef7 100644 --- a/zsub/zsub.go +++ b/zsub/zsub.go @@ -244,13 +244,13 @@ func (c *ZConn) removeTo(arr []*ZConn) []*ZConn { return arr } -// ServerStart ================== ZHub server ===================================== +// StartServer ================== ZHub server ===================================== /* -ServerStart +StartServer 1、load history data 2、init server */ -func ServerStart(addr string) { +func StartServer(addr string) { GetStr("data.dir", "data") go func() { @@ -273,7 +273,7 @@ func ServerStart(addr string) { if err != nil { log.Fatal(err) } - log.Printf("zhub started listen on: %s \n", addr) + log.Println("zhub.server = ", addr) for { conn, err := listen.Accept()