dissertation-2-code/udp/congestion/none.go
Jake Hillion 87c0b57502
Some checks reported errors
continuous-integration/drone/push Build was killed
removed cc reset
2021-02-22 16:28:55 +00:00

42 lines
692 B
Go

package congestion
import (
"fmt"
"time"
)
type None struct {
sequence chan uint32
}
func NewNone() *None {
c := None{
sequence: make(chan uint32),
}
go func() {
var s uint32
for {
if s == 0 {
s++
continue
}
c.sequence <- s
s++
}
}()
return &c
}
func (c *None) String() string {
return fmt.Sprintf("{None}")
}
func (c *None) ReceivedPacket(uint32, uint32, uint32) {}
func (c *None) NextNack() uint32 { return 0 }
func (c *None) NextAck() uint32 { return 0 }
func (c *None) AwaitEarlyUpdate(time.Duration) uint32 { select {} }
func (c *None) Sequence() uint32 { return <-c.sequence }