From 550fd89472fe1b96b56a9135f4e591ef315bf2d7 Mon Sep 17 00:00:00 2001 From: sawka Date: Sat, 13 Aug 2022 10:27:22 -0700 Subject: [PATCH] fix datapos --- pkg/remote/remote.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/remote/remote.go b/pkg/remote/remote.go index 4adf98642..a43742c99 100644 --- a/pkg/remote/remote.go +++ b/pkg/remote/remote.go @@ -359,7 +359,7 @@ func (runner *MShellProc) ProcessPackets() { } runner.notifyHangups_nolock() }) - var dataPos int64 + dataPosMap := make(map[base.CommandKey]int64) for pk := range runner.ServerProc.Output.MainCh { if pk.GetType() == packet.DataPacketStr { dataPk := pk.(*packet.DataPacketType) @@ -371,13 +371,14 @@ func (runner *MShellProc) ProcessPackets() { } var ack *packet.DataAckPacketType if len(realData) > 0 { + dataPos := dataPosMap[dataPk.CK] err = sstore.AppendToCmdPtyBlob(context.Background(), dataPk.CK.GetSessionId(), dataPk.CK.GetCmdId(), realData, dataPos) if err != nil { ack = makeDataAckPacket(dataPk.CK, dataPk.FdNum, 0, err) } else { ack = makeDataAckPacket(dataPk.CK, dataPk.FdNum, len(realData), nil) } - dataPos += int64(len(realData)) + dataPosMap[dataPk.CK] += int64(len(realData)) } if ack != nil { runner.ServerProc.Input.SendPacket(ack)