mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
refine code, move the order of functions.
This commit is contained in:
parent
71f2726b31
commit
65b2ed7ac5
4 changed files with 514 additions and 513 deletions
File diff suppressed because it is too large
Load diff
|
@ -253,6 +253,11 @@ public:
|
||||||
* @remark, user can test the config before reload it.
|
* @remark, user can test the config before reload it.
|
||||||
*/
|
*/
|
||||||
virtual int reload();
|
virtual int reload();
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* reload the vhost section of config.
|
||||||
|
*/
|
||||||
|
virtual int reload_vhost(SrsConfDirective* old_root);
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* reload from the config.
|
* reload from the config.
|
||||||
|
@ -269,10 +274,6 @@ private:
|
||||||
*/
|
*/
|
||||||
virtual int reload_http_stream(SrsConfDirective* old_root);
|
virtual int reload_http_stream(SrsConfDirective* old_root);
|
||||||
/**
|
/**
|
||||||
* reload the vhost section of config.
|
|
||||||
*/
|
|
||||||
virtual int reload_vhost(SrsConfDirective* old_root);
|
|
||||||
/**
|
|
||||||
* reload the transcode section of vhost of config.
|
* reload the transcode section of vhost of config.
|
||||||
*/
|
*/
|
||||||
virtual int reload_transcode(SrsConfDirective* new_vhost, SrsConfDirective* old_vhost);
|
virtual int reload_transcode(SrsConfDirective* new_vhost, SrsConfDirective* old_vhost);
|
||||||
|
@ -413,7 +414,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* get all vhosts in config file.
|
* get all vhosts in config file.
|
||||||
*/
|
*/
|
||||||
virtual std::vector<SrsConfDirective*> get_vhosts();
|
virtual void get_vhosts(std::vector<SrsConfDirective*>& vhosts);
|
||||||
/**
|
/**
|
||||||
* whether vhost is enabled
|
* whether vhost is enabled
|
||||||
* @param vhost, the vhost name.
|
* @param vhost, the vhost name.
|
||||||
|
|
|
@ -543,20 +543,21 @@ int SrsHttpApi::do_cycle()
|
||||||
// always free it in this scope.
|
// always free it in this scope.
|
||||||
SrsAutoFree(ISrsHttpMessage, req);
|
SrsAutoFree(ISrsHttpMessage, req);
|
||||||
|
|
||||||
// TODO: FIXME: use the post body.
|
|
||||||
std::string res;
|
|
||||||
|
|
||||||
// get response body.
|
|
||||||
if ((ret = req->body_read_all(res)) != ERROR_SUCCESS) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ok, handle http request.
|
// ok, handle http request.
|
||||||
SrsHttpResponseWriter writer(&skt);
|
SrsHttpResponseWriter writer(&skt);
|
||||||
if ((ret = process_request(&writer, req)) != ERROR_SUCCESS) {
|
if ((ret = process_request(&writer, req)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read all rest bytes in request body.
|
||||||
|
char buf[SRS_HTTP_READ_CACHE_BYTES];
|
||||||
|
ISrsHttpResponseReader* br = req->body_reader();
|
||||||
|
while (!br->eof()) {
|
||||||
|
if ((ret = br->read(buf, SRS_HTTP_READ_CACHE_BYTES, NULL)) != ERROR_SUCCESS) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// donot keep alive, disconnect it.
|
// donot keep alive, disconnect it.
|
||||||
// @see https://github.com/simple-rtmp-server/srs/issues/399
|
// @see https://github.com/simple-rtmp-server/srs/issues/399
|
||||||
if (!req->is_keep_alive()) {
|
if (!req->is_keep_alive()) {
|
||||||
|
|
|
@ -293,7 +293,8 @@ int SrsIngester::parse()
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
// parse ingesters
|
// parse ingesters
|
||||||
std::vector<SrsConfDirective*> vhosts = _srs_config->get_vhosts();
|
std::vector<SrsConfDirective*> vhosts;
|
||||||
|
_srs_config->get_vhosts(vhosts);
|
||||||
|
|
||||||
for (int i = 0; i < (int)vhosts.size(); i++) {
|
for (int i = 0; i < (int)vhosts.size(); i++) {
|
||||||
SrsConfDirective* vhost = vhosts[i];
|
SrsConfDirective* vhost = vhosts[i];
|
||||||
|
|
Loading…
Reference in a new issue