move the RTTStats to the utils package

The RTTStats are used by the logging package. In order to instrument the
congestion package, the RTTStats can't be part of that package any more
(to avoid an import loop).
This commit is contained in:
Marten Seemann
2020-07-22 14:18:57 +07:00
parent ce16603a24
commit 741dc28d74
29 changed files with 129 additions and 139 deletions

View File

@@ -4,7 +4,6 @@ import (
"sync"
"time"
"github.com/lucas-clemente/quic-go/internal/congestion"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/utils"
)
@@ -25,7 +24,7 @@ type baseFlowController struct {
epochStartTime time.Time
epochStartOffset protocol.ByteCount
rttStats *congestion.RTTStats
rttStats *utils.RTTStats
logger utils.Logger
}

View File

@@ -5,7 +5,8 @@ import (
"strconv"
"time"
"github.com/lucas-clemente/quic-go/internal/congestion"
"github.com/lucas-clemente/quic-go/internal/utils"
"github.com/lucas-clemente/quic-go/internal/protocol"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -27,7 +28,7 @@ var _ = Describe("Base Flow controller", func() {
BeforeEach(func() {
controller = &baseFlowController{}
controller.rttStats = &congestion.RTTStats{}
controller.rttStats = &utils.RTTStats{}
})
Context("send flow control", func() {

View File

@@ -4,7 +4,6 @@ import (
"fmt"
"time"
"github.com/lucas-clemente/quic-go/internal/congestion"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/qerr"
"github.com/lucas-clemente/quic-go/internal/utils"
@@ -24,7 +23,7 @@ func NewConnectionFlowController(
receiveWindow protocol.ByteCount,
maxReceiveWindow protocol.ByteCount,
queueWindowUpdate func(),
rttStats *congestion.RTTStats,
rttStats *utils.RTTStats,
logger utils.Logger,
) ConnectionFlowController {
return &connectionFlowController{

View File

@@ -3,7 +3,6 @@ package flowcontrol
import (
"time"
"github.com/lucas-clemente/quic-go/internal/congestion"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/utils"
. "github.com/onsi/ginkgo"
@@ -25,13 +24,13 @@ var _ = Describe("Connection Flow controller", func() {
BeforeEach(func() {
queuedWindowUpdate = false
controller = &connectionFlowController{}
controller.rttStats = &congestion.RTTStats{}
controller.rttStats = &utils.RTTStats{}
controller.logger = utils.DefaultLogger
controller.queueWindowUpdate = func() { queuedWindowUpdate = true }
})
Context("Constructor", func() {
rttStats := &congestion.RTTStats{}
rttStats := &utils.RTTStats{}
It("sets the send and receive windows", func() {
receiveWindow := protocol.ByteCount(2000)

View File

@@ -3,7 +3,6 @@ package flowcontrol
import (
"fmt"
"github.com/lucas-clemente/quic-go/internal/congestion"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/qerr"
"github.com/lucas-clemente/quic-go/internal/utils"
@@ -31,7 +30,7 @@ func NewStreamFlowController(
maxReceiveWindow protocol.ByteCount,
initialSendWindow protocol.ByteCount,
queueWindowUpdate func(protocol.StreamID),
rttStats *congestion.RTTStats,
rttStats *utils.RTTStats,
logger utils.Logger,
) StreamFlowController {
return &streamFlowController{

View File

@@ -3,7 +3,6 @@ package flowcontrol
import (
"time"
"github.com/lucas-clemente/quic-go/internal/congestion"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/utils"
. "github.com/onsi/ginkgo"
@@ -18,7 +17,7 @@ var _ = Describe("Stream Flow controller", func() {
BeforeEach(func() {
queuedWindowUpdate = false
rttStats := &congestion.RTTStats{}
rttStats := &utils.RTTStats{}
controller = &streamFlowController{
streamID: 10,
connection: NewConnectionFlowController(1000, 1000, func() {}, rttStats, utils.DefaultLogger).(*connectionFlowController),
@@ -30,7 +29,7 @@ var _ = Describe("Stream Flow controller", func() {
})
Context("Constructor", func() {
rttStats := &congestion.RTTStats{}
rttStats := &utils.RTTStats{}
receiveWindow := protocol.ByteCount(2000)
maxReceiveWindow := protocol.ByteCount(3000)
sendWindow := protocol.ByteCount(4000)