diff --git a/src/croc/croc.go b/src/croc/croc.go index 1cec8960..dc8a648b 100644 --- a/src/croc/croc.go +++ b/src/croc/croc.go @@ -517,7 +517,9 @@ func (c *Client) updateState() (err error) { c.FilesToTransfer[c.FilesToTransferCurrentNum].Size, models.TCP_BUFFER_SIZE/2, ) - c.bar.Add(len(c.CurrentFileChunks) * models.TCP_BUFFER_SIZE / 2) + if len(c.CurrentFileChunks) > 0 { + c.bar.Add(len(c.CurrentFileChunks) * models.TCP_BUFFER_SIZE / 2) + } bRequest, _ := json.Marshal(RemoteFileRequest{ CurrentFileChunks: c.CurrentFileChunks, FilesToTransferCurrentNum: c.FilesToTransferCurrentNum, @@ -547,7 +549,10 @@ func (c *Client) updateState() (err error) { progressbar.OptionSetWriter(os.Stderr), progressbar.OptionThrottle(100*time.Millisecond), ) - c.bar.Add(len(c.CurrentFileChunks) * models.TCP_BUFFER_SIZE / 2) + log.Info(c.CurrentFileChunks) + // if len(c.CurrentFileChunks) > 0 { + // c.bar.Add(len(c.CurrentFileChunks) * models.TCP_BUFFER_SIZE / 2) + // } c.TotalSent = 0 for i := 1; i < len(c.Options.RelayPorts); i++ { go c.sendData(i) diff --git a/src/utils/utils.go b/src/utils/utils.go index 36460c4b..55e411cc 100644 --- a/src/utils/utils.go +++ b/src/utils/utils.go @@ -119,7 +119,7 @@ func ByteCountDecimal(b int64) string { // If the file size is not the same as requested, it returns an empty chunk list (all chunks). func MissingChunks(fname string, fsize int64, chunkSize int) (chunks []int64) { fstat, err := os.Stat(fname) - if fstat.Size() != fsize { + if fstat.Size() != fsize || err != nil { return }