1
This commit is contained in:
@@ -62,7 +62,6 @@ func handleConn(c net.Conn) error {
|
||||
if c == nil {
|
||||
return errors.New("conn is nil")
|
||||
}
|
||||
//nowPrintNo := ""
|
||||
for {
|
||||
buffer, n, err := ConnRead(c)
|
||||
if err != nil {
|
||||
@@ -71,11 +70,6 @@ func handleConn(c net.Conn) error {
|
||||
} else {
|
||||
fmt.Println("ReadString err:", err)
|
||||
}
|
||||
//if nowPrintNo != "" {
|
||||
// globals.SugarLogger.Debugf("打印机连接错误:%v delete : %s", err, nowPrintNo)
|
||||
// changePrinterStatus(nowPrintNo, printerStatusOffline)
|
||||
// delete(PrintObject, nowPrintNo)
|
||||
//}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -94,13 +88,8 @@ func handleConn(c net.Conn) error {
|
||||
_, printNo = getCallbackMsgInfo(data)
|
||||
callback = true
|
||||
}
|
||||
//nowPrintNo = printNo
|
||||
|
||||
t, ok := PrintObject[printNo]
|
||||
if printNo == "120220915001467" {
|
||||
globals.SugarLogger.Debugf("=========ok : %s", utils.Format4Output(ok, false))
|
||||
globals.SugarLogger.Debugf("=========okt : %s", utils.Format4Output(t, false))
|
||||
}
|
||||
if !ok {
|
||||
t = NewTcpClient()
|
||||
buildAllMap(t, printNo)
|
||||
@@ -271,11 +260,13 @@ func doPrint(t *TcpClient, key string) (err error) {
|
||||
printMsg.Status = printMsgErr
|
||||
printMsg.Comment = err.Error()
|
||||
dao.UpdateEntity(db, printMsg, "Status", "Comment")
|
||||
globals.SugarLogger.Debugf("=====1 %v", err)
|
||||
delete(t.TimeoutMap, key)
|
||||
return
|
||||
}
|
||||
|
||||
if _, err = c.Write(data); err != nil {
|
||||
globals.SugarLogger.Debugf("=====2 %v", err)
|
||||
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)
|
||||
//close(t.TimeoutMap[key])
|
||||
delete(t.TimeoutMap, key)
|
||||
@@ -436,7 +427,6 @@ func HandleCheckTcpHeart(t *TcpClient, key string) {
|
||||
if time.Now().Sub(statusTime) > time.Second*75 {
|
||||
globals.SugarLogger.Debugf("超过一分十秒没有心跳的打印机[%s],当前心跳时间: %s ,上一次心跳时间 : %s", key, utils.Time2TimeStr(time.Now()), utils.Time2TimeStr(statusTime))
|
||||
changePrinterStatus(key, printerStatusOffline)
|
||||
delete(t.TimeoutMap, key)
|
||||
delete(PrintObject, key)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user