summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Marc <hi@colinmarc.com>2022-02-05 13:54:29 +0100
committerGitHub <noreply@github.com>2022-02-05 13:54:29 +0100
commitf0bdd6222a3816060c4a0a1f27968516d22d3c24 (patch)
tree2dc70af9a306ae8b57ce37dc859831376d8b2f94
parentb3b2b2910fe40037901e626d9cd18a3018d49745 (diff)
parent9fdb16eb505127ec6736aa9734c553fd2bb71972 (diff)
Merge pull request #276 from moredure/patch-1
use only seqno instead of full outboundPacket in channel
-rw-r--r--internal/transfer/block_write_stream.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/transfer/block_write_stream.go b/internal/transfer/block_write_stream.go
index 4d2f6cf..0f47cb0 100644
--- a/internal/transfer/block_write_stream.go
+++ b/internal/transfer/block_write_stream.go
@@ -55,7 +55,7 @@ type blockWriteStream struct {
offset int64
closed bool
- packets chan outboundPacket
+ packets chan int
seqno int
ackError error
@@ -91,7 +91,7 @@ func newBlockWriteStream(conn io.ReadWriter, offset int64) *blockWriteStream {
conn: conn,
offset: offset,
seqno: 1,
- packets: make(chan outboundPacket, maxPacketsInQueue),
+ packets: make(chan int, maxPacketsInQueue),
acksDone: make(chan struct{}),
heartbeats: make(chan struct{}),
}
@@ -163,7 +163,7 @@ func (s *blockWriteStream) finish() error {
checksums: []byte{},
data: []byte{},
}
- s.packets <- lastPacket
+ s.packets <- lastPacket.seqno
err := s.writePacket(lastPacket)
if err != nil {
@@ -191,7 +191,7 @@ func (s *blockWriteStream) flush(force bool) error {
for s.buf.Len() > 0 && (force || s.buf.Len() >= outboundPacketSize) {
packet := s.makePacket()
- s.packets <- packet
+ s.packets <- packet.seqno
s.offset += int64(len(packet.data))
s.seqno++
@@ -281,7 +281,7 @@ Acks:
}
}
- if seqno != p.seqno {
+ if seqno != p {
s.ackError = ErrInvalidSeqno
break Acks
}