aa
This commit is contained in:
@@ -99,9 +99,9 @@ var (
|
||||
regexpQrr = regexp.MustCompile(byteSignQrRight + "(.*?)" + byteSignQrRightE)
|
||||
regexpSound = regexp.MustCompile(byteSignSound + "(.*?)" + byteSignSoundE)
|
||||
|
||||
printMsgChan = make(chan *model.PrintMsg, 1024)
|
||||
printMsgCallbackChan = make(chan string, 1024)
|
||||
printMsgChanFail = make(chan *model.PrintMsg, 1024)
|
||||
printMsgChan = make(chan *model.PrintMsg, 1024)
|
||||
//printMsgCallbackMap = make(map[string]chan string, 1024)
|
||||
printMsgChanFail = make(chan *model.PrintMsg, 1024)
|
||||
)
|
||||
|
||||
type PrintInfo struct {
|
||||
@@ -112,7 +112,8 @@ type PrintInfo struct {
|
||||
|
||||
//连接的客户端,吧每个客户端都放进来
|
||||
type TcpClient struct {
|
||||
Clients map[string]*PrintInfo
|
||||
Clients map[string]*PrintInfo
|
||||
CallBackMap map[string]chan string
|
||||
*sync.RWMutex
|
||||
}
|
||||
|
||||
@@ -142,6 +143,11 @@ func (t *TcpClient) addConn(c net.Conn, key string, status int) {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TcpClient) buildCallBackMap(key string) {
|
||||
dataChan := make(chan string, 1024)
|
||||
t.CallBackMap[key] = dataChan
|
||||
}
|
||||
|
||||
func (t *TcpClient) getPrintStatus(key string) int {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
@@ -185,7 +191,8 @@ func (t *TcpClient) setPrintStatus(key string, status int) {
|
||||
|
||||
func NewTcpClient() *TcpClient {
|
||||
t := &TcpClient{
|
||||
Clients: make(map[string]*PrintInfo),
|
||||
Clients: make(map[string]*PrintInfo),
|
||||
CallBackMap: make(map[string]chan string, 1024),
|
||||
}
|
||||
t.RWMutex = new(sync.RWMutex)
|
||||
return t
|
||||
|
||||
Reference in New Issue
Block a user