chore: update quic-go, adapt to lack of write tracking (#10456)
Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
@@ -18,7 +18,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/quic-go/quic-go"
|
||||
"github.com/quic-go/quic-go/logging"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
)
|
||||
@@ -40,8 +39,8 @@ func quicNetwork(uri *url.URL) string {
|
||||
}
|
||||
|
||||
type quicTlsConn struct {
|
||||
quic.Connection
|
||||
quic.Stream
|
||||
*quic.Conn
|
||||
*quic.Stream
|
||||
|
||||
// If we created this connection, we should be the ones closing it.
|
||||
createdConn net.PacketConn
|
||||
@@ -49,7 +48,7 @@ type quicTlsConn struct {
|
||||
|
||||
func (q *quicTlsConn) Close() error {
|
||||
sterr := q.Stream.Close()
|
||||
seerr := q.Connection.CloseWithError(0, "closing")
|
||||
seerr := q.Conn.CloseWithError(0, "closing")
|
||||
var pcerr error
|
||||
if q.createdConn != nil {
|
||||
pcerr = q.createdConn.Close()
|
||||
@@ -64,7 +63,7 @@ func (q *quicTlsConn) Close() error {
|
||||
}
|
||||
|
||||
func (q *quicTlsConn) ConnectionState() tls.ConnectionState {
|
||||
return q.Connection.ConnectionState().TLS
|
||||
return q.Conn.ConnectionState().TLS
|
||||
}
|
||||
|
||||
func transportConnUnspecified(conn any) bool {
|
||||
@@ -77,25 +76,6 @@ func transportConnUnspecified(conn any) bool {
|
||||
return err == nil && ip.IsUnspecified()
|
||||
}
|
||||
|
||||
type writeTrackingTracer struct {
|
||||
lastWrite atomic.Int64 // unix nanos
|
||||
}
|
||||
|
||||
func (t *writeTrackingTracer) loggingTracer() *logging.Tracer {
|
||||
return &logging.Tracer{
|
||||
SentPacket: func(net.Addr, *logging.Header, logging.ByteCount, []logging.Frame) {
|
||||
t.lastWrite.Store(time.Now().UnixNano())
|
||||
},
|
||||
SentVersionNegotiationPacket: func(net.Addr, logging.ArbitraryLenConnectionID, logging.ArbitraryLenConnectionID, []logging.Version) {
|
||||
t.lastWrite.Store(time.Now().UnixNano())
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (t *writeTrackingTracer) LastWrite() time.Time {
|
||||
return time.Unix(0, t.lastWrite.Load())
|
||||
}
|
||||
|
||||
// A transportPacketConn is a net.PacketConn that uses a quic.Transport.
|
||||
type transportPacketConn struct {
|
||||
tran *quic.Transport
|
||||
|
||||
Reference in New Issue
Block a user