add very basic congestion window implementation

fixes #22
This commit is contained in:
Lucas Clemente
2016-05-06 11:49:32 +02:00
parent bfe7117329
commit aa46fa06a0

View File

@@ -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
}