mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	fast stop server.
This commit is contained in:
		
							parent
							
								
									3ab5892863
								
							
						
					
					
						commit
						1e4c8f8bf3
					
				
					 2 changed files with 8 additions and 14 deletions
				
			
		| 
						 | 
					@ -270,7 +270,9 @@ int SrsTcpListener::cycle()
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if(client_stfd == NULL){
 | 
					    if(client_stfd == NULL){
 | 
				
			||||||
        // ignore error.
 | 
					        // 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;
 | 
					        return ret;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    srs_verbose("get a client. fd=%d", st_netfd_fileno(client_stfd));
 | 
					    srs_verbose("get a client. fd=%d", st_netfd_fileno(client_stfd));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -566,25 +566,16 @@ void SrsServer::dispose()
 | 
				
			||||||
    close_listeners(SrsListenerRtsp);
 | 
					    close_listeners(SrsListenerRtsp);
 | 
				
			||||||
    close_listeners(SrsListenerFlv);
 | 
					    close_listeners(SrsListenerFlv);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
#ifdef SRS_AUTO_INGEST
 | 
					    // @remark don't dispose ingesters, for too slow.
 | 
				
			||||||
    ingester->dispose();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
#ifdef SRS_AUTO_KAFKA
 | 
					#ifdef SRS_AUTO_KAFKA
 | 
				
			||||||
    kafka->stop();
 | 
					    kafka->stop();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    // dispose the source for hls and dvr.
 | 
				
			||||||
    SrsSource::dispose_all();
 | 
					    SrsSource::dispose_all();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    while (!conns.empty()) {
 | 
					    // @remark don't dispose all connections, for too slow.
 | 
				
			||||||
        std::vector<SrsConnection*>::iterator it;
 | 
					 | 
				
			||||||
        for (it = conns.begin(); it != conns.end(); ++it) {
 | 
					 | 
				
			||||||
            SrsConnection* conn = *it;
 | 
					 | 
				
			||||||
            conn->dispose();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        st_usleep(100 * 1000);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef SRS_AUTO_MEM_WATCH
 | 
					#ifdef SRS_AUTO_MEM_WATCH
 | 
				
			||||||
    srs_memory_report();
 | 
					    srs_memory_report();
 | 
				
			||||||
| 
						 | 
					@ -907,6 +898,7 @@ int SrsServer::cycle()
 | 
				
			||||||
    st_usleep(3 * 1000 * 1000);
 | 
					    st_usleep(3 * 1000 * 1000);
 | 
				
			||||||
    srs_warn("system quit");
 | 
					    srs_warn("system quit");
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					    // normally quit with neccessary cleanup by dispose().
 | 
				
			||||||
    srs_warn("main cycle terminated, system quit normally.");
 | 
					    srs_warn("main cycle terminated, system quit normally.");
 | 
				
			||||||
    dispose();
 | 
					    dispose();
 | 
				
			||||||
    srs_trace("srs terminated");
 | 
					    srs_trace("srs terminated");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue