From e951646fb652e23bce7ba79ee39c4f91c226d213 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sun, 6 Oct 2019 10:31:30 +0200 Subject: [PATCH] tell if a peer supports DATAGRAM frames in the ConnectionState --- interface.go | 3 ++- session.go | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/interface.go b/interface.go index 19d38c74..e27a81d1 100644 --- a/interface.go +++ b/interface.go @@ -264,7 +264,8 @@ type Config struct { // ConnectionState records basic details about a QUIC connection type ConnectionState struct { - TLS handshake.ConnectionState + TLS handshake.ConnectionState + SupportsDatagrams bool } // A Listener for incoming QUIC connections diff --git a/session.go b/session.go index 384530d9..7fc28c0c 100644 --- a/session.go +++ b/session.go @@ -632,9 +632,14 @@ func (s *session) Context() context.Context { return s.ctx } +func (s *session) supportsDatagrams() bool { + return s.peerParams.MaxDatagramFrameSize != protocol.InvalidByteCount +} + func (s *session) ConnectionState() ConnectionState { return ConnectionState{ - TLS: s.cryptoStreamHandler.ConnectionState(), + TLS: s.cryptoStreamHandler.ConnectionState(), + SupportsDatagrams: s.supportsDatagrams(), } }