a
This commit is contained in:
@@ -78,6 +78,7 @@ func (t *TcpClient) handleConn(c net.Conn) {
|
|||||||
//4、读打印channel并打印,并切等待回调channel中的消息
|
//4、读打印channel并打印,并切等待回调channel中的消息
|
||||||
//5、修改数据库中打印机状态(没在连接池中说明是重新连接的)
|
//5、修改数据库中打印机状态(没在连接池中说明是重新连接的)
|
||||||
//6、监听心跳时间,超过2分钟就clear掉
|
//6、监听心跳时间,超过2分钟就clear掉
|
||||||
|
globals.SugarLogger.Debugf("handleConn clients map: %v", t.Clients)
|
||||||
if t.Clients[printNo] == nil {
|
if t.Clients[printNo] == nil {
|
||||||
t.addConn(c, printNo, status)
|
t.addConn(c, printNo, status)
|
||||||
t.buildCallBackMap(printNo)
|
t.buildCallBackMap(printNo)
|
||||||
@@ -230,20 +231,20 @@ func (t *TcpClient) doPrint(key string) (err error) {
|
|||||||
printMsg.Status = printMsgErr
|
printMsg.Status = printMsgErr
|
||||||
printMsg.Comment = err.Error()
|
printMsg.Comment = err.Error()
|
||||||
dao.UpdateEntity(db, printMsg, "Status", "Comment")
|
dao.UpdateEntity(db, printMsg, "Status", "Comment")
|
||||||
//if t.isExist(key) {
|
if t.isExist(key) {
|
||||||
// t.clear(key)
|
t.clear(key)
|
||||||
// close(timeoutChan)
|
close(timeoutChan)
|
||||||
//}
|
}
|
||||||
//return
|
return
|
||||||
} else {
|
} else {
|
||||||
if c != nil {
|
if c != nil {
|
||||||
if _, err = c.Write(data); err != nil {
|
if _, err = c.Write(data); err != nil {
|
||||||
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)
|
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)
|
||||||
//t.delConn(printMsg.PrintNo)
|
//t.delConn(printMsg.PrintNo)
|
||||||
//if t.isExist(key) {
|
if t.isExist(key) {
|
||||||
// t.clear(key)
|
t.clear(key)
|
||||||
// close(timeoutChan)
|
close(timeoutChan)
|
||||||
//}
|
}
|
||||||
} else {
|
} else {
|
||||||
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
|
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
|
||||||
//等待回调
|
//等待回调
|
||||||
|
|||||||
Reference in New Issue
Block a user