change congestion to use protocol.ByteCount

fixes #52
This commit is contained in:
Lucas Clemente
2016-05-05 01:41:34 +02:00
parent 321370e2f3
commit d178a02ad8
10 changed files with 61 additions and 57 deletions

View File

@@ -1,6 +1,10 @@
package congestion
import "time"
import (
"time"
"github.com/lucas-clemente/quic-go/protocol"
)
// Bandwidth of a connection
type Bandwidth uint64
@@ -17,6 +21,6 @@ const (
)
// BandwidthFromDelta calculates the bandwidth from a number of bytes and a time delta
func BandwidthFromDelta(bytes uint64, delta time.Duration) Bandwidth {
func BandwidthFromDelta(bytes protocol.ByteCount, delta time.Duration) Bandwidth {
return Bandwidth(bytes) * Bandwidth(time.Second) / Bandwidth(delta) * BytesPerSecond
}