dissertation-2-code/udp/congestion/none.go
Jake Hillion ff4ce07b05
All checks were successful
continuous-integration/drone/push Build is passing
functional udp
2020-11-27 20:17:59 +00:00

45 lines
863 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) {}
func (c *None) ReceivedAck(uint32) {}
func (c *None) ReceivedNack(uint32) {}
func (c *None) Reset() {}
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 }