mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
client connection no disconnect
This commit is contained in:
parent
9b8f6ff962
commit
1e34d2a5cd
5 changed files with 38 additions and 2 deletions
23
trunk/src/app/srs_app_recv_thread.cpp
Normal file → Executable file
23
trunk/src/app/srs_app_recv_thread.cpp
Normal file → Executable file
|
@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <srs_kernel_utility.hpp>
|
||||
#include <srs_core_performance.hpp>
|
||||
#include <srs_app_config.hpp>
|
||||
#include <srs_app_source.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -138,11 +139,12 @@ SrsQueueRecvThread::SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms)
|
|||
{
|
||||
rtmp = rtmp_sdk;
|
||||
recv_error_code = ERROR_SUCCESS;
|
||||
_consumer = NULL;
|
||||
}
|
||||
|
||||
SrsQueueRecvThread::~SrsQueueRecvThread()
|
||||
{
|
||||
trd.stop();
|
||||
stop();
|
||||
|
||||
// clear all messages.
|
||||
std::vector<SrsCommonMessage*>::iterator it;
|
||||
|
@ -160,6 +162,7 @@ int SrsQueueRecvThread::start()
|
|||
|
||||
void SrsQueueRecvThread::stop()
|
||||
{
|
||||
_consumer = NULL;
|
||||
trd.stop();
|
||||
}
|
||||
|
||||
|
@ -195,7 +198,13 @@ bool SrsQueueRecvThread::can_handle()
|
|||
// for the message may cause the thread to stop,
|
||||
// when stop, the thread is freed, so the messages
|
||||
// are dropped.
|
||||
return empty();
|
||||
bool e = empty();
|
||||
#ifdef SRS_PERF_QUEUE_COND_WAIT
|
||||
if (_consumer && !e) {
|
||||
_consumer->on_dispose();
|
||||
}
|
||||
#endif
|
||||
return e;
|
||||
}
|
||||
|
||||
int SrsQueueRecvThread::handle(SrsCommonMessage* msg)
|
||||
|
@ -209,6 +218,11 @@ int SrsQueueRecvThread::handle(SrsCommonMessage* msg)
|
|||
|
||||
void SrsQueueRecvThread::on_recv_error(int ret)
|
||||
{
|
||||
#ifdef SRS_PERF_QUEUE_COND_WAIT
|
||||
if (_consumer) {
|
||||
_consumer->on_dispose();
|
||||
}
|
||||
#endif
|
||||
recv_error_code = ret;
|
||||
}
|
||||
|
||||
|
@ -226,6 +240,11 @@ void SrsQueueRecvThread::on_thread_stop()
|
|||
rtmp->set_auto_response(true);
|
||||
}
|
||||
|
||||
void SrsQueueRecvThread::set_consumer(SrsConsumer *consumer)
|
||||
{
|
||||
_consumer = consumer;
|
||||
}
|
||||
|
||||
SrsPublishRecvThread::SrsPublishRecvThread(
|
||||
SrsRtmpServer* rtmp_sdk,
|
||||
SrsRequest* _req, int mr_sock_fd, int timeout_ms,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue