winlin

fast stop server.

@@ -270,7 +270,9 @@ int SrsTcpListener::cycle() @@ -270,7 +270,9 @@ int SrsTcpListener::cycle()
270 270
271 if(client_stfd == NULL){ 271 if(client_stfd == NULL){
272 // ignore error. 272 // ignore error.
273 - srs_error("ignore accept thread stoppped for accept client error"); 273 + if (errno != EINTR) {
  274 + srs_error("ignore accept thread stoppped for accept client error");
  275 + }
274 return ret; 276 return ret;
275 } 277 }
276 srs_verbose("get a client. fd=%d", st_netfd_fileno(client_stfd)); 278 srs_verbose("get a client. fd=%d", st_netfd_fileno(client_stfd));
@@ -553,22 +553,13 @@ void SrsServer::dispose() @@ -553,22 +553,13 @@ void SrsServer::dispose()
553 close_listeners(SrsListenerRtsp); 553 close_listeners(SrsListenerRtsp);
554 close_listeners(SrsListenerFlv); 554 close_listeners(SrsListenerFlv);
555 555
556 -#ifdef SRS_AUTO_INGEST  
557 - ingester->dispose();  
558 -#endif 556 + // @remark don't dispose ingesters, for too slow.
559 557
  558 + // dispose the source for hls and dvr.
560 SrsSource::dispose_all(); 559 SrsSource::dispose_all();
561 560
562 - while (!conns.empty()) {  
563 - std::vector<SrsConnection*>::iterator it;  
564 - for (it = conns.begin(); it != conns.end(); ++it) {  
565 - SrsConnection* conn = *it;  
566 - conn->dispose();  
567 - }  
568 -  
569 - st_usleep(100 * 1000);  
570 - }  
571 - 561 + // @remark don't dispose all connections, for too slow.
  562 +
572 #ifdef SRS_AUTO_MEM_WATCH 563 #ifdef SRS_AUTO_MEM_WATCH
573 srs_memory_report(); 564 srs_memory_report();
574 #endif 565 #endif
@@ -871,6 +862,7 @@ int SrsServer::cycle() @@ -871,6 +862,7 @@ int SrsServer::cycle()
871 st_usleep(3 * 1000 * 1000); 862 st_usleep(3 * 1000 * 1000);
872 srs_warn("system quit"); 863 srs_warn("system quit");
873 #else 864 #else
  865 + // normally quit with neccessary cleanup by dispose().
874 srs_warn("main cycle terminated, system quit normally."); 866 srs_warn("main cycle terminated, system quit normally.");
875 dispose(); 867 dispose();
876 srs_trace("srs terminated"); 868 srs_trace("srs terminated");