mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SRT: Reduce the SRT bug by limit the max times for retry.
This commit is contained in:
parent
339d942e7b
commit
0c036e0435
3 changed files with 23 additions and 1 deletions
|
@ -26,6 +26,7 @@ static long long MONITOR_TIMEOUT = 5000;
|
|||
const unsigned int DEF_DATA_SIZE = 188*7;
|
||||
const long long CHECK_ALIVE_INTERVAL = 5*1000;
|
||||
const long long CHECK_ALIVE_TIMEOUT = 5*1000;
|
||||
static const int SRT_WRTIE_FAIL_MAX = 10;
|
||||
|
||||
long long srt_now_ms = 0;
|
||||
|
||||
|
@ -216,6 +217,7 @@ void srt_handle::handle_push_data(SRT_SOCKSTATUS status, const std::string& subp
|
|||
srt_log_info("receive data size(%d) from pusher(%d) to pullers, count:%d",
|
||||
ret, conn_fd, streamid_iter->second.size());
|
||||
|
||||
std::vector<SRTSOCKET> remove_vec;
|
||||
for (auto puller_iter = streamid_iter->second.begin();
|
||||
puller_iter != streamid_iter->second.end();
|
||||
puller_iter++) {
|
||||
|
@ -228,6 +230,17 @@ void srt_handle::handle_push_data(SRT_SOCKSTATUS status, const std::string& subp
|
|||
srt_log_info("send data size(%d) to puller fd:%d", write_ret, puller_iter->first);
|
||||
if (write_ret > 0) {
|
||||
puller_iter->second->update_timestamp(srt_now_ms);
|
||||
} else {
|
||||
if (player_conn->get_write_fail_count() > SRT_WRTIE_FAIL_MAX) {
|
||||
remove_vec.push_back(puller_iter->first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto item : remove_vec) {
|
||||
streamid_iter->second.erase(item);
|
||||
if (streamid_iter->second.empty()) {
|
||||
_streamid_map.erase(streamid_iter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue