forked from quic-go/quic-go
handshake: store key update interval in an atomic (#5234)
* handshake: store key update interval in an atomic We recently changed the way the key update interval is set in tests to use an environment variable. This resolved a race condition that existed in the earlier logic, however, parsing of the environment variable now shows up in benchmark tests. Using an atomic variable should have a negligible performance impact. * use an atomic swap
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/quic-go/quic-go"
|
||||
"github.com/quic-go/quic-go/internal/handshake"
|
||||
"github.com/quic-go/quic-go/internal/protocol"
|
||||
"github.com/quic-go/quic-go/logging"
|
||||
|
||||
@@ -14,7 +15,8 @@ import (
|
||||
)
|
||||
|
||||
func TestKeyUpdates(t *testing.T) {
|
||||
t.Setenv("QUIC_GO_TEST_KEY_UPDATE_INTERVAL", "1") // update keys as frequently as possible
|
||||
reset := handshake.SetKeyUpdateInterval(1) // update keys as frequently as possible
|
||||
t.Cleanup(reset)
|
||||
|
||||
var sentHeaders []*logging.ShortHeader
|
||||
var receivedHeaders []*logging.ShortHeader
|
||||
|
||||
Reference in New Issue
Block a user