mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine the get port, return a vector<string> contains ports.
This commit is contained in:
parent
1243d962b8
commit
96e0e699dd
4 changed files with 40 additions and 22 deletions
|
@ -759,16 +759,16 @@ int SrsServer::listen_rtmp()
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
// stream service port.
|
||||
SrsConfDirective* conf = _srs_config->get_listen();
|
||||
srs_assert(conf);
|
||||
std::vector<std::string> ports = _srs_config->get_listen();
|
||||
srs_assert((int)ports.size() > 0);
|
||||
|
||||
close_listeners(SrsListenerRtmpStream);
|
||||
|
||||
for (int i = 0; i < (int)conf->args.size(); i++) {
|
||||
for (int i = 0; i < (int)ports.size(); i++) {
|
||||
SrsListener* listener = new SrsListener(this, SrsListenerRtmpStream);
|
||||
listeners.push_back(listener);
|
||||
|
||||
int port = ::atoi(conf->args.at(i).c_str());
|
||||
int port = ::atoi(ports[i].c_str());
|
||||
if ((ret = listener->listen(port)) != ERROR_SUCCESS) {
|
||||
srs_error("RTMP stream listen at port %d failed. ret=%d", port, ret);
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue