1
This commit is contained in:
@@ -88,11 +88,11 @@ func handleConn(c net.Conn) error {
|
||||
callback = true
|
||||
}
|
||||
|
||||
if _, have := TcpClientList[printNo]; !have {
|
||||
if value, have := TcpClientList.Load(printNo); !have {
|
||||
t = NewTcpClient()
|
||||
TcpClientList[printNo] = t
|
||||
TcpClientList.Store(printNo, t)
|
||||
} else {
|
||||
t = TcpClientList[printNo]
|
||||
t = value.(*TcpClient)
|
||||
}
|
||||
if heartbeat {
|
||||
// 证明是心跳
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
var TcpClientList = make(map[string]*TcpClient, 0)
|
||||
var TcpClientList = new(sync.Map)
|
||||
|
||||
const (
|
||||
heartText = "1e000f02000151" // 老版心跳
|
||||
@@ -843,6 +843,7 @@ func HandleCheckTcpHeart(t *TcpClient, key string) {
|
||||
close(t.CallBackMap[key])
|
||||
//t.delConn(key)
|
||||
t.clear(key)
|
||||
TcpClientList.Delete(key)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user