From 2776f7ee0a2cc961b4515be2e03a7dd8e61a6d5c Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Wed, 21 Jul 2021 18:47:54 +0800 Subject: [PATCH] aa --- business/jxstore/event/event_tcp.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index fbf04c602..247a03547 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -304,14 +304,19 @@ 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") - - 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) + 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 + } } + } } }