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
|
@ -122,7 +122,8 @@ bool get_streamid_info(const std::string& streamid, int& mode, std::string& url_
|
|||
}
|
||||
|
||||
srt_conn::srt_conn(SRTSOCKET conn_fd, const std::string& streamid):_conn_fd(conn_fd),
|
||||
_streamid(streamid) {
|
||||
_streamid(streamid),
|
||||
write_fail_cnt_(0) {
|
||||
get_streamid_info(streamid, _mode, _url_subpath);
|
||||
|
||||
_update_timestamp = now_ms();
|
||||
|
@ -195,7 +196,13 @@ int srt_conn::write(unsigned char* data, int len) {
|
|||
ret = srt_send(_conn_fd, (char*)data, len);
|
||||
if (ret <= 0) {
|
||||
srt_log_error("srt write error:%d, socket fd:%d", ret, _conn_fd);
|
||||
write_fail_cnt_++;
|
||||
return ret;
|
||||
}
|
||||
write_fail_cnt_ = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int srt_conn::get_write_fail_count() {
|
||||
return write_fail_cnt_;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue