control_queue.go 496 B

1234567891011121314151617181920212223242526272829
  1. package sctp
  2. // control queue
  3. type controlQueue struct {
  4. queue []*packet
  5. }
  6. func newControlQueue() *controlQueue {
  7. return &controlQueue{queue: []*packet{}}
  8. }
  9. func (q *controlQueue) push(c *packet) {
  10. q.queue = append(q.queue, c)
  11. }
  12. func (q *controlQueue) pushAll(packets []*packet) {
  13. q.queue = append(q.queue, packets...)
  14. }
  15. func (q *controlQueue) popAll() []*packet {
  16. packets := q.queue
  17. q.queue = []*packet{}
  18. return packets
  19. }
  20. func (q *controlQueue) size() int {
  21. return len(q.queue)
  22. }