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

refine code for bug #217, use recv thread to set the timeout.

This commit is contained in:
winlin 2014-11-22 18:08:45 +08:00
parent 5408169b6e
commit 3e81e6e0f1
3 changed files with 30 additions and 17 deletions

View file

@ -96,3 +96,27 @@ int SrsRecvThread::cycle()
return ret;
}
void SrsRecvThread::on_thread_start()
{
// the multiple messages writev improve performance large,
// but the timeout recv will cause 33% sys call performance,
// to use isolate thread to recv, can improve about 33% performance.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/194
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
rtmp->set_recv_timeout(ST_UTIME_NO_TIMEOUT);
// disable the protocol auto response,
// for the isolate recv thread should never send any messages.
rtmp->set_auto_response(false);
}
void SrsRecvThread::on_thread_stop()
{
// enable the protocol auto response,
// for the isolate recv thread terminated.
rtmp->set_auto_response(true);
// reset the timeout to pulse mode.
rtmp->set_recv_timeout(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US);
}