From 5da7ccdbc9c113e2c0ffeb9b08a972fc682acd03 Mon Sep 17 00:00:00 2001 From: Stephen Merrony Date: Tue, 12 Feb 2019 16:40:04 +0100 Subject: [PATCH] Only count correctly received picture chunks. Addresses Issue #10 --- tello.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tello.go b/tello.go index c7e3d3c..ab57644 100644 --- a/tello.go +++ b/tello.go @@ -342,9 +342,9 @@ func (tello *Tello) controlResponseListener() { if !already { tello.fileTemp.pieces[thisChunk.pieceNum].chunks = append(tello.fileTemp.pieces[thisChunk.pieceNum].chunks, thisChunk) tello.fileTemp.accumSize += len(thisChunk.chunkData) + tello.fileTemp.pieces[thisChunk.pieceNum].numChunks++ } } - tello.fileTemp.pieces[thisChunk.pieceNum].numChunks++ tello.fdMu.Unlock() if tello.fileTemp.pieces[thisChunk.pieceNum].numChunks == 8 { // piece has 8 chunks, it's complete