From 02aad5d2568750a7948be4aa1be4ddc810e5833a Mon Sep 17 00:00:00 2001 From: xiongguangjie Date: Thu, 22 Sep 2022 19:21:14 +0800 Subject: [PATCH] srt avoid ack time map memory not release --- srt/SrtTransport.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/srt/SrtTransport.cpp b/srt/SrtTransport.cpp index b39f7f28..89a83cb2 100644 --- a/srt/SrtTransport.cpp +++ b/srt/SrtTransport.cpp @@ -473,6 +473,18 @@ void SrtTransport::handleACKACK(uint8_t *buf, int len, struct sockaddr_storage * } } + if(_ack_send_timestamp.size()>1000){ + // clear data + for(auto it = _ack_send_timestamp.begin(); it != _ack_send_timestamp.end();){ + if(DurationCountMicroseconds(_now-it->second)>5e6){ + // 超过五秒没有ackack 丢弃 + it = _ack_send_timestamp.erase(it); + }else{ + it++; + } + } + } + } }