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

For #913, config and log support complex error.

This commit is contained in:
winlin 2017-06-11 14:03:19 +08:00
parent 860aac3e50
commit b5c14938d9
13 changed files with 267 additions and 353 deletions

View file

@ -73,7 +73,7 @@ namespace _srs_internal
/**
* fullfill the buffer with content of file specified by filename.
*/
virtual int fullfill(const char* filename);
virtual srs_error_t fullfill(const char* filename);
/**
* whether buffer is empty.
*/
@ -119,7 +119,7 @@ extern std::string srs_config_bool2switch(const std::string& sbool);
* so we must transform the vhost directive anytime load the config.
* @param root the root directive to transform, in and out parameter.
*/
extern int srs_config_transform_vhost(SrsConfDirective* root);
extern srs_error_t srs_config_transform_vhost(SrsConfDirective* root);
// @global config object.
extern SrsConfig* _srs_config;
@ -239,7 +239,7 @@ public:
/**
* parse config directive from file buffer.
*/
virtual int parse(_srs_internal::SrsConfigBuffer* buffer);
virtual srs_error_t parse(_srs_internal::SrsConfigBuffer* buffer);
/**
* persistence the directive to writer.
* @param level, the root is level0, all its directives are level1, and so on.
@ -277,7 +277,7 @@ private:
* 2. initialize the directive by args, args[0] is name, args[1-N] is args of directive,
* 3. if ret flag indicates there are child-directives, read_conf(directive, block) recursively.
*/
virtual int parse_conf(_srs_internal::SrsConfigBuffer* buffer, SrsDirectiveType type);
virtual srs_error_t parse_conf(_srs_internal::SrsConfigBuffer* buffer, SrsDirectiveType type);
/**
* read a token from buffer.
* a token, is the directive args and a flag indicates whether has child-directives.
@ -285,7 +285,7 @@ private:
* @param line_start, the actual start line of directive.
* @return, an error code indicates error or has child-directives.
*/
virtual int read_token(_srs_internal::SrsConfigBuffer* buffer, std::vector<std::string>& args, int& line_start);
virtual srs_error_t read_token(_srs_internal::SrsConfigBuffer* buffer, std::vector<std::string>& args, int& line_start);
};
/**
@ -412,12 +412,12 @@ public:
/**
* parse the cli, the main(argc,argv) function.
*/
virtual int parse_options(int argc, char** argv);
virtual srs_error_t parse_options(int argc, char** argv);
/**
* initialize the cwd for server,
* because we may change the workdir.
*/
virtual int initialize_cwd();
virtual srs_error_t initialize_cwd();
/**
* persistence current config to file.
*/
@ -530,7 +530,7 @@ private:
/**
* parse each argv.
*/
virtual int parse_argv(int& i, char** argv);
virtual srs_error_t parse_argv(int& i, char** argv);
/**
* print help and exit.
*/
@ -539,21 +539,21 @@ public:
/**
* parse the config file, which is specified by cli.
*/
virtual int parse_file(const char* filename);
virtual srs_error_t parse_file(const char* filename);
/**
* check the parsed config.
*/
virtual int check_config();
virtual srs_error_t check_config();
protected:
virtual int check_normal_config();
virtual int check_number_connections();
virtual srs_error_t check_normal_config();
virtual srs_error_t check_number_connections();
protected:
/**
* parse config from the buffer.
* @param buffer, the config buffer, user must delete it.
* @remark, use protected for the utest to override with mock.
*/
virtual int parse_buffer(_srs_internal::SrsConfigBuffer* buffer);
virtual srs_error_t parse_buffer(_srs_internal::SrsConfigBuffer* buffer);
// global env
public:
/**