t.log.L(`I: `, `初始化录制(`+strconv.Itoa(t.common.Roomid)+`)`)
defer t.log.L(`I: `, `结束录制(`+strconv.Itoa(t.common.Roomid)+`)`)
- defer t.exitSign.Done()
- defer t.Status.Done()
+ defer func() {
+ // use anonymous func avoid data race and unexpect sign wait
+ t.Status.Done()
+ t.exitSign.Done()
+ }()
// 初始化请求池
t.reqPool = t.common.ReqPool
defer cancelfunc()
}
- for exit_sign := true; exit_sign; {
+ for exitSign := false; !exitSign; {
if c.C.Roomid == 0 {
fmt.Println("回车查看指令")
ctx, cancel := context.WithCancel(context.Background())
select {
case <-c:
case <-interrupt_chan:
- exit_sign = false
+ exitSign = true
}
cancel1()
cancel()
fmt.Print("房间号: ", strconv.Itoa(c.C.Roomid), "\n")
}
- if !exit_sign {
+ if exitSign {
break
}
var cancelfunc = c.C.Danmu_Main_mq.Pull_tag(msgq.FuncMap{
`interrupt`: func(_ any) (disable bool) {
exitloop = true
- exit_sign = false
+ exitSign = true
ws_c.Close()
danmulog.L(`I: `, "停止,等待服务器断开连接")
reply.StreamOStop(-1) //停止录制