]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Improve PID信息放入公共变量
authorqydysky <32743305+qydysky@users.noreply.github.com>
Sun, 19 Feb 2023 14:12:46 +0000 (22:12 +0800)
committerqydysky <32743305+qydysky@users.noreply.github.com>
Sun, 19 Feb 2023 14:12:46 +0000 (22:12 +0800)
CV/Var.go
bili_danmu.go
demo/main.go

index 0f0abe8be0e80c92987ad4c801de0919fae41acf..e6c8198cad987c81ca8f2605eb6e3cff7d21833c 100644 (file)
--- 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",
index 9665c091c398e41cfabb22780dbce48ac6aa5f31..0d7a910e3578884d4ebb4f78c5c01d8660055a9e 100644 (file)
@@ -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 {
index 79af7380ed43bfb58a98d7a2ad047920e705455c..77ca66609254bae197866b0a1a576a856d68c266 100644 (file)
@@ -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)