don't send more packets when there are too many unacked

fixes #249, fixes #322
This commit is contained in:
Lucas Clemente
2016-09-08 11:21:03 +02:00
parent 2ca0fb7d21
commit a0fb14381e
5 changed files with 18 additions and 10 deletions

View File

@@ -269,8 +269,10 @@ func (h *sentPacketHandler) GetStopWaitingFrame(force bool) *frames.StopWaitingF
return h.stopWaitingManager.GetStopWaitingFrame(force)
}
func (h *sentPacketHandler) CongestionAllowsSending() bool {
return h.BytesInFlight() <= h.congestion.GetCongestionWindow()
func (h *sentPacketHandler) SendingAllowed() bool {
congestionLimited := h.BytesInFlight() > h.congestion.GetCongestionWindow()
maxTrackedLimited := protocol.PacketNumber(len(h.retransmissionQueue)+h.packetHistory.Len()) >= protocol.MaxTrackedSentPackets
return !(congestionLimited || maxTrackedLimited)
}
func (h *sentPacketHandler) CheckForError() error {