From d4af8df996cf6f5f19a23c7ac729d7bb96764225 Mon Sep 17 00:00:00 2001 From: qydysky <32743305+qydysky@users.noreply.github.com> Date: Sun, 19 Feb 2023 22:12:46 +0800 Subject: [PATCH] =?utf8?q?Improve=20PID=E4=BF=A1=E6=81=AF=E6=94=BE?= =?utf8?q?=E5=85=A5=E5=85=AC=E5=85=B1=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- CV/Var.go | 4 ++++ bili_danmu.go | 2 ++ demo/main.go | 8 +------- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CV/Var.go b/CV/Var.go index 0f0abe8..e6c8198 100644 --- a/CV/Var.go +++ b/CV/Var.go @@ -8,6 +8,7 @@ import ( "io" "net/http" "net/url" + "os" "runtime" "strings" "testing" @@ -24,6 +25,7 @@ import ( ) type Common struct { + PID int //进程id Uid int //client uid Live []LiveQn //直播流链接 Live_qn int //当前直播流质量 @@ -133,6 +135,8 @@ type StreamType struct { } func (t *Common) Init() Common { + t.PID = os.Getpid() + t.AllStreamType = map[string]StreamType{ `fmp4`: { Protocol_name: "http_hls", diff --git a/bili_danmu.go b/bili_danmu.go index 9665c09..0d7a910 100644 --- a/bili_danmu.go +++ b/bili_danmu.go @@ -59,6 +59,8 @@ func Start() { os.Exit(1) }() + danmulog.L(`I: `, `当前PID:`, c.C.PID) + //启动时显示ip { if v, ok := c.C.K_v.LoadV("启动时显示ip").(bool); ok && v { diff --git a/demo/main.go b/demo/main.go index 79af738..77ca666 100644 --- a/demo/main.go +++ b/demo/main.go @@ -1,14 +1,9 @@ package main -import ( - // "runtime" +import ( // "runtime" // "runtime/pprof" - "os" - // "log" - "fmt" // "net/http" // _ "net/http/pprof" - // "github.com/skratchdot/open-golang/open" q "github.com/qydysky/bili_danmu" ) @@ -22,7 +17,6 @@ func main() { // time.Sleep(time.Duration(3)*time.Second) // }() // go func() { - fmt.Printf("PID:%d\n", os.Getpid()) // for { // View() // time.Sleep(time.Duration(60) * time.Second) -- 2.39.2