Source File
payload_queue.go
Belonging Package
github.com/pion/sctp
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage sctptype payloadQueue struct {chunks *queue[*chunkPayloadData]nBytes int}func newPayloadQueue() *payloadQueue {return &payloadQueue{chunks: newQueue[*chunkPayloadData](128)}}func ( *payloadQueue) ( *chunkPayloadData) {.chunks.PushBack().nBytes += len(.userData)}// pop pops only if the oldest chunk's TSN matches the given TSN.func ( *payloadQueue) ( uint32) (*chunkPayloadData, bool) {if .chunks.Len() > 0 && == .chunks.Front().tsn {:= .chunks.PopFront().nBytes -= len(.userData)return , true}return nil, false}// get returns reference to chunkPayloadData with the given TSN value.func ( *payloadQueue) ( uint32) (*chunkPayloadData, bool) {:= .chunks.Len()if == 0 {return nil, false}:= .chunks.Front().tsnif < || int(-) >= {return nil, false}return .chunks.At(int( - )), true}func ( *payloadQueue) ( uint32) int {var intif , := .get(); {.acked = true.retransmit = false= len(.userData).nBytes -=.userData = []byte{}}return}func ( *payloadQueue) () {for := 0; < .chunks.Len(); ++ {:= .chunks.At()if .acked || .abandoned() {continue}.retransmit = true}}func ( *payloadQueue) () int {return .nBytes}func ( *payloadQueue) () int {return .chunks.Len()}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |