diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2c605a7..9e73a80 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -32,18 +32,10 @@ jobs: - name: Test run: go test -v -coverprofile=coverage.txt -covermode=atomic ./... - - - name: Codecov upload coverage - shell: bash - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - RUN_ID: ${{ github.run_id }} - 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 + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: soypat/lneto + \ No newline at end of file diff --git a/tcp/txqueue.go b/tcp/txqueue.go index 3d24111..44fdccb 100644 --- a/tcp/txqueue.go +++ b/tcp/txqueue.go @@ -2,7 +2,6 @@ package tcp import ( "errors" - "time" "github.com/soypat/lneto/internal" ) @@ -18,9 +17,6 @@ type ringTx struct { rawbuf []byte // packets contains 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 int // unsentend is the offset of end of unsent data in rawbuf. @@ -38,9 +34,7 @@ type ringidx struct { end int // seq is the sequence number of the packet. seq Value - t time.Time - // acked flags if this packet has been acknowledged. Useful for SACK (selective acknowledgement) - // acked bool + // time is a measure of the instant of time message was sent at. } // 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 } -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 func (tx *ringTx) RecvACK(ack Value) error { for i := range tx.packets { diff --git a/tcp/txqueue_test.go b/tcp/txqueue_test.go index f6c2546..4ccae0f 100644 --- a/tcp/txqueue_test.go +++ b/tcp/txqueue_test.go @@ -34,7 +34,7 @@ func TestTxQueue_SequentialMessages(t *testing.T) { t.Fatalf("want %d unsent buffered, got %d", unsent, len(msg)) } sent := rtx.BufferedSent() - if sent > 0 { + if sent != 0 { t.Fatalf("want 0 bytes sent, got %d", sent) } n, seq, err := rtx.MakePacket(data[:]) @@ -47,6 +47,10 @@ func TestTxQueue_SequentialMessages(t *testing.T) { } else if seq != prevSeq { 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) err = rtx.RecvACK(prevSeq) if err != nil {