TUN-5600: Close QUIC transports as soon as possible while respecting graceful shutdown

This does a few fixes to make sure that the QUICConnection returns from
Serve when the context is cancelled.

QUIC transport now behaves like other transports: closes as soon as there
is no traffic, or at most by grace-period. Note that we do not wait for
UDP traffic since that's connectionless by design.
This commit is contained in:
Nuno Diegues
2022-01-04 19:00:44 +00:00
parent ead93e9f26
commit 628545d229
4 changed files with 33 additions and 17 deletions

View File

@@ -548,7 +548,7 @@ func ServeQUIC(
config.ConnectionConfig.OriginProxy,
connOptions,
controlStreamHandler,
config.Observer)
connLogger.Logger())
if err != nil {
connLogger.ConnAwareLogger().Err(err).Msgf("Failed to create new quic connection")
return err, true
@@ -556,11 +556,11 @@ func ServeQUIC(
errGroup, serveCtx := errgroup.WithContext(ctx)
errGroup.Go(func() error {
err := quicConn.Serve(ctx)
err := quicConn.Serve(serveCtx)
if err != nil {
connLogger.ConnAwareLogger().Err(err).Msg("Failed to serve quic connection")
}
return fmt.Errorf("Connection with edge closed")
return err
})
errGroup.Go(func() error {