This commit is contained in:
suyl
2021-07-22 09:29:28 +08:00
parent 2776f7ee0a
commit 8c1bbd795a

View File

@@ -226,8 +226,8 @@ func handleConn(c net.Conn) {
tcpClient.s.Unlock()
}
} else if strings.Contains(data, printText) {
//globals.SugarLogger.Debugf("handleConn print callback: %v", data)
//changePrintMsg(data)
globals.SugarLogger.Debugf("handleConn print callback: %v", data)
changePrintMsg(data)
}
}
}
@@ -304,19 +304,6 @@ func doPrint(printMsgChanFail chan *model.PrintMsg) (err error) {
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
printMsg.Status = printMsgAlreadySend
dao.UpdateEntity(db, printMsg, "Status", "Comment")
for {
buffer := make([]byte, 1024)
n, _ := c.Read(buffer)
data := hex.EncodeToString(buffer[:n])
if strings.Contains(data, printText) {
globals.SugarLogger.Debugf("handleConn print callback: %v", data)
changePrintMsg(data)
}
if len(buffer) > 0 {
break
}
}
}
}
}