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

For #913, refine server utility

This commit is contained in:
winlin 2017-06-10 15:20:48 +08:00
parent ca9f0bdb1e
commit a20e2c3ef6
15 changed files with 222 additions and 244 deletions

View file

@ -240,8 +240,8 @@ srs_error_t SrsHttpStaticServer::initialize()
if (!default_root_exists) {
// add root
std::string dir = _srs_config->get_http_stream_dir();
if ((ret = mux.handle("/", new SrsVodStream(dir))) != ERROR_SUCCESS) {
return srs_error_new(ret, "mount root dir=%s", dir.c_str());
if ((err = mux.handle("/", new SrsVodStream(dir))) != srs_success) {
return srs_error_wrap(err, "mount root dir=%s", dir.c_str());
}
srs_trace("http: root mount to %s", dir.c_str());
}
@ -252,6 +252,7 @@ srs_error_t SrsHttpStaticServer::initialize()
int SrsHttpStaticServer::mount_vhost(string vhost, string& pmount)
{
int ret = ERROR_SUCCESS;
srs_error_t err = srs_success;
// when vhost disabled, ignore.
if (!_srs_config->get_vhost_enabled(vhost)) {
@ -279,7 +280,11 @@ int SrsHttpStaticServer::mount_vhost(string vhost, string& pmount)
}
// mount the http of vhost.
if ((ret = mux.handle(mount, new SrsVodStream(dir))) != ERROR_SUCCESS) {
if ((err = mux.handle(mount, new SrsVodStream(dir))) != srs_success) {
// TODO: FIXME: Use error.
ret = srs_error_code(err);
srs_freep(err);
srs_error("http: mount dir=%s for vhost=%s failed. ret=%d", dir.c_str(), vhost.c_str(), ret);
return ret;
}