2024-06-05 20:10:03 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2022-03-10 09:44:48 +00:00
|
|
|
package sctp
|
|
|
|
|
|
|
|
// control queue
|
|
|
|
|
|
|
|
type controlQueue struct {
|
|
|
|
queue []*packet
|
|
|
|
}
|
|
|
|
|
|
|
|
func newControlQueue() *controlQueue {
|
|
|
|
return &controlQueue{queue: []*packet{}}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q *controlQueue) push(c *packet) {
|
|
|
|
q.queue = append(q.queue, c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q *controlQueue) pushAll(packets []*packet) {
|
|
|
|
q.queue = append(q.queue, packets...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q *controlQueue) popAll() []*packet {
|
|
|
|
packets := q.queue
|
|
|
|
q.queue = []*packet{}
|
|
|
|
return packets
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q *controlQueue) size() int {
|
|
|
|
return len(q.queue)
|
|
|
|
}
|