mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SRT: Close connection if RTMP failed. (#2917)
* SRT: using global variables to pass errors (#2897) * SRT: using global variables to pass errors (#2897)
This commit is contained in:
parent
0a848430e9
commit
e8fca60ece
5 changed files with 49 additions and 25 deletions
|
@ -206,6 +206,19 @@ void srt_handle::handle_push_data(SRT_SOCKSTATUS status, const std::string& subp
|
|||
srt_conn_ptr->update_timestamp(srt_now_ms);
|
||||
|
||||
srt2rtmp::get_instance()->insert_data_message(data, ret, subpath);
|
||||
{
|
||||
std::unique_lock<std::mutex> locker(srt2rtmp::_srt_error_mutex);
|
||||
if (srt2rtmp::_srt_error_map.count(subpath) == 1) {
|
||||
int err_code = srt2rtmp::_srt_error_map[subpath];
|
||||
if (err_code != ERROR_SUCCESS) {
|
||||
close_push_conn(conn_fd);
|
||||
srt_log_error("handle_push_data srt to rtmp error:%d, fd:%d", err_code,conn_fd);
|
||||
//todo: reset to next use, maybe update by srt2rtmp::cycle again
|
||||
srt2rtmp::_srt_error_map[subpath] = ERROR_SUCCESS;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//send data to subscriber(players)
|
||||
//streamid, play map<SRTSOCKET, SRT_CONN_PTR>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue