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

for #209, server cycle to enable the hls to cleanup. do dispose

This commit is contained in:
winlin 2015-05-30 10:48:02 +08:00
parent 567d84e997
commit d611bb6b45
8 changed files with 109 additions and 3 deletions

View file

@ -771,6 +771,32 @@ SrsSource* SrsSource::fetch(std::string vhost, std::string app, std::string stre
return source;
}
void SrsSource::dispose_all()
{
std::map<std::string, SrsSource*>::iterator it;
for (it = pool.begin(); it != pool.end(); ++it) {
SrsSource* source = it->second;
source->dispose();
}
return;
}
int SrsSource::cycle_all()
{
int ret = ERROR_SUCCESS;
// TODO: FIXME: support remove dead source for a long time.
std::map<std::string, SrsSource*>::iterator it;
for (it = pool.begin(); it != pool.end(); ++it) {
SrsSource* source = it->second;
if ((ret = source->cycle()) != ERROR_SUCCESS) {
return ret;
}
}
return ret;
}
void SrsSource::destroy()
{
std::map<std::string, SrsSource*>::iterator it;
@ -909,6 +935,26 @@ SrsSource::~SrsSource()
srs_freep(_req);
}
void SrsSource::dispose()
{
#ifdef SRS_AUTO_HLS
hls->dispose();
#endif
}
int SrsSource::cycle()
{
int ret = ERROR_SUCCESS;
#ifdef SRS_AUTO_HLS
if ((ret = hls->cycle()) != ERROR_SUCCESS) {
return ret;
}
#endif
return ret;
}
int SrsSource::initialize(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandler* hh)
{
int ret = ERROR_SUCCESS;