aa
This commit is contained in:
@@ -107,8 +107,6 @@ var (
|
||||
regexpQrl = regexp.MustCompile(byteSignQrLeft + "(.*?)" + byteSignQrLeftE)
|
||||
regexpQrr = regexp.MustCompile(byteSignQrRight + "(.*?)" + byteSignQrRightE)
|
||||
regexpSound = regexp.MustCompile(byteSignSound + "(.*?)" + byteSignSoundE)
|
||||
|
||||
timeoutChan = make(chan bool)
|
||||
)
|
||||
|
||||
type PrintInfo struct {
|
||||
@@ -122,6 +120,7 @@ type TcpClient struct {
|
||||
Clients map[string]*PrintInfo //放tcp连接的,printNo 为key
|
||||
MsgMap map[string]chan *model.PrintMsg //放打印信息的,printNo为key
|
||||
CallBackMap map[string]chan string //放打印信息回调信息的,printNo为key
|
||||
TimeoutChan chan bool //退出channel
|
||||
*sync.RWMutex
|
||||
}
|
||||
|
||||
@@ -150,6 +149,9 @@ func (t *TcpClient) addConn(c net.Conn, key string, status int) {
|
||||
Status: status,
|
||||
StatusTime: time.Now(),
|
||||
}
|
||||
if t.TimeoutChan == nil {
|
||||
t.TimeoutChan = make(chan bool)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TcpClient) buildMsgMap(key string) {
|
||||
@@ -281,6 +283,7 @@ func NewTcpClient() *TcpClient {
|
||||
Clients: make(map[string]*PrintInfo),
|
||||
CallBackMap: make(map[string]chan string),
|
||||
MsgMap: make(map[string]chan *model.PrintMsg),
|
||||
TimeoutChan: make(chan bool),
|
||||
}
|
||||
t.RWMutex = new(sync.RWMutex)
|
||||
return t
|
||||
|
||||
Reference in New Issue
Block a user