1
0
Fork 0
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:
winlin 2014-07-18 10:21:34 +08:00
parent 1243d962b8
commit 96e0e699dd
4 changed files with 40 additions and 22 deletions

View file

@ -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;