fix codecov yaml

This commit is contained in:
soypat
2025-01-24 22:44:19 -03:00
parent 83719ffe98
commit 8191874c49
3 changed files with 13 additions and 31 deletions
+7 -15
View File
@@ -32,18 +32,10 @@ jobs:
- name: Test - name: Test
run: go test -v -coverprofile=coverage.txt -covermode=atomic ./... run: go test -v -coverprofile=coverage.txt -covermode=atomic ./...
- name: Codecov upload coverage - name: Upload coverage reports to Codecov
shell: bash uses: codecov/codecov-action@v5
env: with:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
RUN_ID: ${{ github.run_id }} slug: soypat/lneto
run: |
# Replace `linux` below with the appropriate OS
# Options are `alpine`, `linux`, `macos`, `windows`
# You will need to setup the environment variables below in github
# and the project in codecov.io: https://app.codecov.io/gh/${{ github.repository }}
go test -v -coverprofile=coverage.txt -covermode=atomic ./...
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov --verbose upload-process --fail-on-error -t $CODECOV_TOKEN -n 'service'-$RUN_ID -F service -f coverage.txt
+1 -15
View File
@@ -2,7 +2,6 @@ package tcp
import ( import (
"errors" "errors"
"time"
"github.com/soypat/lneto/internal" "github.com/soypat/lneto/internal"
) )
@@ -18,9 +17,6 @@ type ringTx struct {
rawbuf []byte rawbuf []byte
// packets contains // packets contains
packets []ringidx packets []ringidx
// _firstPkt is the index of the oldest packet in the packets field.
// _firstPkt int
// _lastPkt int
// unsentOff is the offset of start of unsent data into rawbuf. // unsentOff is the offset of start of unsent data into rawbuf.
unsentoff int unsentoff int
// unsentend is the offset of end of unsent data in rawbuf. // unsentend is the offset of end of unsent data in rawbuf.
@@ -38,9 +34,7 @@ type ringidx struct {
end int end int
// seq is the sequence number of the packet. // seq is the sequence number of the packet.
seq Value seq Value
t time.Time // time is a measure of the instant of time message was sent at.
// acked flags if this packet has been acknowledged. Useful for SACK (selective acknowledgement)
// acked bool
} }
// Reset resets the RingTx's internal state to use buf as the main ring buffer and creates or reuses // Reset resets the RingTx's internal state to use buf as the main ring buffer and creates or reuses
@@ -130,14 +124,6 @@ func (tx *ringTx) MakePacket(b []byte) (int, Value, error) {
return n, seq, nil return n, seq, nil
} }
func (tx *ringTx) packetRing(i int) internal.Ring {
pkt := tx.packets[i]
if pkt.off < 0 {
return internal.Ring{}
}
return tx.ring(pkt.off, pkt.end)
}
// RecvSegment processes an incoming segment and updates the sent packet queue // RecvSegment processes an incoming segment and updates the sent packet queue
func (tx *ringTx) RecvACK(ack Value) error { func (tx *ringTx) RecvACK(ack Value) error {
for i := range tx.packets { for i := range tx.packets {
+5 -1
View File
@@ -34,7 +34,7 @@ func TestTxQueue_SequentialMessages(t *testing.T) {
t.Fatalf("want %d unsent buffered, got %d", unsent, len(msg)) t.Fatalf("want %d unsent buffered, got %d", unsent, len(msg))
} }
sent := rtx.BufferedSent() sent := rtx.BufferedSent()
if sent > 0 { if sent != 0 {
t.Fatalf("want 0 bytes sent, got %d", sent) t.Fatalf("want 0 bytes sent, got %d", sent)
} }
n, seq, err := rtx.MakePacket(data[:]) n, seq, err := rtx.MakePacket(data[:])
@@ -47,6 +47,10 @@ func TestTxQueue_SequentialMessages(t *testing.T) {
} else if seq != prevSeq { } else if seq != prevSeq {
t.Fatalf("want seq %d, got %d", prevSeq, seq) t.Fatalf("want seq %d, got %d", prevSeq, seq)
} }
sent = rtx.BufferedSent()
if sent != len(msg) {
t.Fatalf("want %d sent, got %d", len(msg), sent)
}
prevSeq += Value(n) prevSeq += Value(n)
err = rtx.RecvACK(prevSeq) err = rtx.RecvACK(prevSeq)
if err != nil { if err != nil {