From 1e4c8f8bf3f6c064dce95fb357f35c5be27636b2 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 11 Dec 2015 10:30:13 +0800 Subject: [PATCH] fast stop server. --- trunk/src/app/srs_app_listener.cpp | 4 +++- trunk/src/app/srs_app_server.cpp | 18 +++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/trunk/src/app/srs_app_listener.cpp b/trunk/src/app/srs_app_listener.cpp index 183343168..c1309e781 100644 --- a/trunk/src/app/srs_app_listener.cpp +++ b/trunk/src/app/srs_app_listener.cpp @@ -270,7 +270,9 @@ int SrsTcpListener::cycle() if(client_stfd == NULL){ // ignore error. - srs_error("ignore accept thread stoppped for accept client error"); + if (errno != EINTR) { + srs_error("ignore accept thread stoppped for accept client error"); + } return ret; } srs_verbose("get a client. fd=%d", st_netfd_fileno(client_stfd)); diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 93897b545..115db9685 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -566,26 +566,17 @@ void SrsServer::dispose() close_listeners(SrsListenerRtsp); close_listeners(SrsListenerFlv); -#ifdef SRS_AUTO_INGEST - ingester->dispose(); -#endif + // @remark don't dispose ingesters, for too slow. #ifdef SRS_AUTO_KAFKA kafka->stop(); #endif + // dispose the source for hls and dvr. SrsSource::dispose_all(); - while (!conns.empty()) { - std::vector::iterator it; - for (it = conns.begin(); it != conns.end(); ++it) { - SrsConnection* conn = *it; - conn->dispose(); - } - - st_usleep(100 * 1000); - } - + // @remark don't dispose all connections, for too slow. + #ifdef SRS_AUTO_MEM_WATCH srs_memory_report(); #endif @@ -907,6 +898,7 @@ int SrsServer::cycle() st_usleep(3 * 1000 * 1000); srs_warn("system quit"); #else + // normally quit with neccessary cleanup by dispose(). srs_warn("main cycle terminated, system quit normally."); dispose(); srs_trace("srs terminated");