Make RTMP listen optional.
This commit is contained in:
parent
1606c3d713
commit
123df8a75a
|
|
@ -1878,13 +1878,6 @@ srs_error_t SrsConfig::check_normal_config()
|
|||
|
||||
srs_trace("srs checking config...");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check empty
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
if (!env_only_ && root_->directives_.size() == 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "conf is empty");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check root directives.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -2010,9 +2003,6 @@ srs_error_t SrsConfig::check_normal_config()
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
if (true) {
|
||||
vector<string> listens = get_listens();
|
||||
if (!env_only_ && listens.size() <= 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "listen requires params");
|
||||
}
|
||||
for (int i = 0; i < (int)listens.size(); i++) {
|
||||
if (!srs_net_is_valid_endpoint(listens[i])) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "rtmp.listen=%s is invalid", listens[i].c_str());
|
||||
|
|
|
|||
|
|
@ -975,41 +975,26 @@ VOID TEST(ConfigDirectiveTest, ParseLineNormal)
|
|||
EXPECT_EQ(3, (int)dir2.conf_line_);
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, ParseEmpty)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_FAILED(conf.mock_parse(""));
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, ParseMinConf)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.mock_parse(_MIN_OK_CONF));
|
||||
// Min conf with RTMP server.
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.mock_parse(_MIN_OK_CONF));
|
||||
|
||||
vector<string> listens = conf.get_listens();
|
||||
EXPECT_EQ(1, (int)listens.size());
|
||||
EXPECT_STREQ("1935", listens.at(0).c_str());
|
||||
}
|
||||
vector<string> listens = conf.get_listens();
|
||||
EXPECT_EQ(1, (int)listens.size());
|
||||
EXPECT_STREQ("1935", listens.at(0).c_str());
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, ParseInvalidDirective)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_FAILED(conf.mock_parse("listens 1935;"));
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, ParseInvalidDirective2)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
MockSrsConfig conf;
|
||||
// check error for user not specified the listen directive.
|
||||
HELPER_ASSERT_FAILED(conf.mock_parse("chunk_size 4096;"));
|
||||
// RTMP is optional now.
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
// check error for user not specified the listen directive.
|
||||
HELPER_ASSERT_SUCCESS(conf.mock_parse(""));
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, CheckConf_listen)
|
||||
|
|
|
|||
|
|
@ -89,19 +89,6 @@ srs_error_t MockSrsReloadConfig::do_reload(string buf)
|
|||
return err;
|
||||
}
|
||||
|
||||
VOID TEST(ConfigReloadTest, ReloadEmpty)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
MockReloadHandler handler;
|
||||
MockSrsReloadConfig conf;
|
||||
|
||||
conf.subscribe(&handler);
|
||||
HELPER_EXPECT_FAILED(conf.mock_parse(""));
|
||||
HELPER_EXPECT_FAILED(conf.do_reload(""));
|
||||
EXPECT_TRUE(handler.all_false());
|
||||
}
|
||||
|
||||
VOID TEST(ConfigReloadTest, ReloadVhostChunkSize)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user