- irc::portparser portrange(porttag, false);
- int portno = -1;
- while (0 != (portno = portrange.GetToken()))
+ // A TCP listener with no ports is not very useful.
+ if (portlist.empty())
+ this->Logs->Log("SOCKET", LOG_DEFAULT, "TCP listener on %s at %s has no ports specified!",
+ address.empty() ? "*" : address.c_str(), tag->getTagLocation().c_str());
+
+ irc::portparser portrange(portlist, false);
+ for (int port; (port = portrange.GetToken()); )
+ {
+ irc::sockets::sockaddrs bindspec;
+ if (!irc::sockets::aptosa(address, port, bindspec))
+ continue;
+
+ if (!BindPort(tag, bindspec, old_ports))
+ failed_ports.push_back(std::make_pair(bindspec, errno));
+ else
+ bound++;
+ }
+ continue;
+ }
+
+#ifndef _WIN32
+ // Are we creating a UNIX listener?
+ const std::string path = tag->getString("path");
+ if (!path.empty())