diff --git a/session.go b/session.go index 93def6a5d..99e0c7ec5 100644 --- a/session.go +++ b/session.go @@ -323,6 +323,10 @@ func (s *Session) closeStreamsWithError(err error) { } func (s *Session) sendPacket() error { + if !s.congestionAllowsSending() { + return nil + } + var controlFrames []frames.Frame // check for retransmissions first @@ -446,3 +450,7 @@ func (s *Session) scheduleSending() { default: } } + +func (s *Session) congestionAllowsSending() bool { + return protocol.ByteCount(s.sentPacketHandler.BytesInFlight()) < 100*protocol.DefaultTCPMSS +}