workarounds to dropping being too aggressive

This commit is contained in:
Arceliar
2020-05-16 17:40:11 -05:00
parent b132560f65
commit b17a035a05
2 changed files with 6 additions and 1 deletions

View File

@@ -55,6 +55,11 @@ func (q *packetQueue) drop() bool {
}
// Drop the oldest packet from the worst stream
packet := worstStream.infos[0].packet
if q.size-uint64(len(packet)) < streamMsgSize {
// TODO something better
// We don't want to drop *all* packets, so lets save 1 batch worth...
return false
}
worstStream.infos = worstStream.infos[1:]
worstStream.size -= uint64(len(packet))
q.size -= uint64(len(packet))