- irc::sockets::aptosa(addr.c_str(), port, &bind_to);
- irc::sockets::satoap(&bind_to, bind_addr, bind_port);
-
- // Preserve empty string for wildcard binds, rather than "::" or "0.0.0.0"
- if (addr.empty())
- bind_addr = addr;
+
+ bind_addr = addr;
+ bind_port = port;
+
+ // canonicalize address if it is defined
+ if (!addr.empty() && irc::sockets::aptosa(addr.c_str(), port, &bind_to))
+ irc::sockets::satoap(&bind_to, bind_addr, bind_port);