mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
parent
714e182096
commit
3f94d26ca4
4 changed files with 47 additions and 3 deletions
|
@ -3617,9 +3617,17 @@ srs_error_t SrsConfig::check_normal_config()
|
|||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "listen requires params");
|
||||
}
|
||||
for (int i = 0; i < (int)listens.size(); i++) {
|
||||
string port = listens[i];
|
||||
if (port.empty() || ::atoi(port.c_str()) <= 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "listen.port=%s is invalid", port.c_str());
|
||||
int port; string ip;
|
||||
srs_parse_endpoint(listens[i], ip, port);
|
||||
|
||||
// check ip
|
||||
if (!srs_check_ip_addr_valid(ip)) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "listen.ip=%s is invalid", ip.c_str());
|
||||
}
|
||||
|
||||
// check port
|
||||
if (port <= 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "listen.port=%d is invalid", port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue