1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for bug #237, when recv thread failed, quit the cycle. 2.0.44

This commit is contained in:
winlin 2014-12-02 15:21:08 +08:00
parent b28dc7364e
commit 757cffbabf
4 changed files with 48 additions and 9 deletions

View file

@ -80,6 +80,9 @@ int SrsRecvThread::cycle()
// we use no timeout to recv, should never got any error.
trd->stop_loop();
// notice the handler got a recv error.
handler->on_recv_error(ret);
return ret;
}
@ -122,6 +125,7 @@ void SrsRecvThread::on_thread_stop()
SrsQueueRecvThread::SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms)
: trd(this, rtmp_sdk, timeout_ms)
{
recv_error_code = ERROR_SUCCESS;
}
SrsQueueRecvThread::~SrsQueueRecvThread()
@ -168,6 +172,11 @@ SrsMessage* SrsQueueRecvThread::pump()
return msg;
}
int SrsQueueRecvThread::error_code()
{
return recv_error_code;
}
bool SrsQueueRecvThread::can_handle()
{
// we only recv one message and then process it,
@ -186,6 +195,11 @@ int SrsQueueRecvThread::handle(SrsMessage* msg)
return ERROR_SUCCESS;
}
void SrsQueueRecvThread::on_recv_error(int ret)
{
recv_error_code = ret;
}
SrsPublishRecvThread::SrsPublishRecvThread(
SrsRtmpServer* rtmp_sdk, int timeout_ms,
SrsRtmpConn* conn, SrsSource* source, bool is_fmle, bool is_edge
@ -254,3 +268,8 @@ int SrsPublishRecvThread::handle(SrsMessage* msg)
// TODO: FIXME: implements it.
return ret;
}
void SrsPublishRecvThread::on_recv_error(int ret)
{
recv_error_code = ret;
}