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:
parent
860aac3e50
commit
b5c14938d9
13 changed files with 267 additions and 353 deletions
|
@ -50,9 +50,9 @@ MockSrsConfigBuffer::~MockSrsConfigBuffer()
|
|||
{
|
||||
}
|
||||
|
||||
int MockSrsConfigBuffer::fullfill(const char* /*filename*/)
|
||||
srs_error_t MockSrsConfigBuffer::fullfill(const char* /*filename*/)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
return srs_success;
|
||||
}
|
||||
|
||||
MockSrsConfig::MockSrsConfig()
|
||||
|
@ -63,22 +63,25 @@ MockSrsConfig::~MockSrsConfig()
|
|||
{
|
||||
}
|
||||
|
||||
int MockSrsConfig::parse(string buf)
|
||||
srs_error_t MockSrsConfig::parse(string buf)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
MockSrsConfigBuffer buffer(buf);
|
||||
|
||||
if ((ret = parse_buffer(&buffer)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
if ((err = parse_buffer(&buffer)) != srs_success) {
|
||||
return srs_error_wrap(err, "parse buffer");
|
||||
}
|
||||
|
||||
if ((ret = srs_config_transform_vhost(root)) != ERROR_SUCCESS) {
|
||||
srs_error("transform config failed. ret=%d", ret);
|
||||
return ret;
|
||||
if ((err = srs_config_transform_vhost(root)) != srs_success) {
|
||||
return srs_error_wrap(err, "transform config");
|
||||
}
|
||||
|
||||
return check_normal_config();
|
||||
if ((err = check_normal_config()) != srs_success) {
|
||||
return srs_error_wrap(err, "check normal config");
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UTEST_CONFIG
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
MockSrsConfigBuffer(std::string buf);
|
||||
virtual ~MockSrsConfigBuffer();
|
||||
public:
|
||||
virtual int fullfill(const char* filename);
|
||||
virtual srs_error_t fullfill(const char* filename);
|
||||
};
|
||||
|
||||
class MockSrsConfig : public SrsConfig
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
MockSrsConfig();
|
||||
virtual ~MockSrsConfig();
|
||||
public:
|
||||
virtual int parse(std::string buf);
|
||||
virtual srs_error_t parse(std::string buf);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -283,16 +283,21 @@ MockSrsReloadConfig::~MockSrsReloadConfig()
|
|||
{
|
||||
}
|
||||
|
||||
int MockSrsReloadConfig::do_reload(string buf)
|
||||
srs_error_t MockSrsReloadConfig::do_reload(string buf)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
MockSrsReloadConfig conf;
|
||||
if ((ret = conf.parse(buf)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
if ((err = conf.parse(buf)) != srs_success) {
|
||||
return srs_error_wrap(err, "parse");
|
||||
}
|
||||
|
||||
if ((ret = MockSrsConfig::reload_conf(&conf)) != ERROR_SUCCESS) {
|
||||
return srs_error_new(ret, "reload conf");
|
||||
}
|
||||
|
||||
return MockSrsConfig::reload_conf(&conf);
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UTEST_RELOAD
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
MockSrsReloadConfig();
|
||||
virtual ~MockSrsReloadConfig();
|
||||
public:
|
||||
virtual int do_reload(std::string buf);
|
||||
virtual srs_error_t do_reload(std::string buf);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue