diff options
| author | 2026-03-14 05:48:58 +0000 | |
|---|---|---|
| committer | 2026-03-14 06:12:35 +0000 | |
| commit | 7cec5d80b3b5e2935a3a38c42a4c9763200f1c87 (patch) | |
| tree | ae708db2e8c79d3d80b4a843ab5cec7e2d113dc4 /src/socket.cpp | |
| parent | Rewrite sepstream and move to stringutils. (diff) | |
Rewrite portparser and move to stringutils.
Diffstat (limited to 'src/socket.cpp')
| -rw-r--r-- | src/socket.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index c88823c1b..aabe0efe3 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -112,24 +112,17 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports) continue; } - irc::portparser portrange(portlist, false); - while (long port = portrange.GetToken()) + NumberRange portrange(portlist); + for (in_port_t port; portrange.GetToken(port); ) { - // Check if the port is out of range. - if (port <= std::numeric_limits<in_port_t>::min() || port > std::numeric_limits<in_port_t>::max()) - { - failed_ports.emplace_back(FMT::format("Port is not valid: {}", port), bindspec, tag); - continue; - } - switch (bindspec.family()) { case AF_INET: - bindspec.in4.sin_port = htons(static_cast<in_port_t>(port)); + bindspec.in4.sin_port = htons(port); break; case AF_INET6: - bindspec.in6.sin6_port = htons(static_cast<in_port_t>(port)); + bindspec.in6.sin6_port = htons(port); break; default: |
