summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Faraponov <11322032+moredure@users.noreply.github.com>2021-10-18 14:05:53 +0300
committerGitHub <noreply@github.com>2021-10-18 14:05:53 +0300
commit635417ec54027aa2fd31a5f22a29a2c285528107 (patch)
treeb4d1403a6cd04eb686cb00d576220ac6d43d1dc7
parentf2f512db170db82ad41590c4ba3b7718b13317d2 (diff)
Update block_write_stream.go
-rw-r--r--internal/transfer/block_write_stream.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/internal/transfer/block_write_stream.go b/internal/transfer/block_write_stream.go
index 9c9d208..4d2f6cf 100644
--- a/internal/transfer/block_write_stream.go
+++ b/internal/transfer/block_write_stream.go
@@ -225,13 +225,9 @@ func (s *blockWriteStream) makePacket() outboundPacket {
offset: s.offset,
last: false,
checksums: make([]byte, numChunks*4),
- data: make([]byte, packetLength),
+ data: s.buf.Next(packetLength),
}
- // TODO: we shouldn't actually need this extra copy. We should also be able
- // to "reuse" packets.
- io.ReadFull(&s.buf, packet.data)
-
// Fill in the checksum for each chunk of data.
for i := 0; i < numChunks; i++ {
chunkOff := i * outboundChunkSize