浏览代码

update ota

liuxiulin 7 月之前
父节点
当前提交
e6c63a5821
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      services/emqx-agent/agent.go

+ 5 - 0
services/emqx-agent/agent.go

@@ -326,8 +326,13 @@ func (a *Access) chunkUpgrade(params rpcs.ChunkUpgrade) error {
 	if stop >= len(fileReply.File) {
 		stop = len(fileReply.File)
 	}
+	if stop < start {
+		start = stop
+	}
 	server.Log.Infof("文件截取位置------: start:%d,stop:%d", start, stop)
+
 	data := fileReply.File[start:stop]
+
 	buf.Write(gbinary.BeEncodeUint16(gconv.Uint16(len(data))))
 	buf.Write(data)
 	server.Log.Infof("1----------填充文件:%2X", buf.Bytes())