]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socket.cpp
Fall back to copying bind IP if getsockname() fails, as it apparently can on Windows
[user/henk/code/inspircd.git] / src / socket.cpp
index 049d3a2379b6d81e91bb387e94f9d52a824a9574..0ceb40330650f1ca9668aaa020190df05b956f0b 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -86,8 +86,9 @@ int InspIRCd::BindPorts(FailedPortList &failed_ports)
                while (0 != (portno = portrange.GetToken()))
                {
                        irc::sockets::sockaddrs bindspec;
-                       irc::sockets::aptosa(Addr, portno, bindspec);
-                       std::string bind_readable = irc::sockets::satouser(bindspec);
+                       if (!irc::sockets::aptosa(Addr, portno, bindspec))
+                               continue;
+                       std::string bind_readable = bindspec.str();
 
                        bool skip = false;
                        for (std::vector<ListenSocket*>::iterator n = old_ports.begin(); n != old_ports.end(); ++n)
@@ -101,7 +102,8 @@ int InspIRCd::BindPorts(FailedPortList &failed_ports)
                        }
                        if (!skip)
                        {
-                               ListenSocket *ll = new ListenSocket(tag, Addr, portno);
+                               ListenSocket* ll = new ListenSocket(tag, bindspec);
+
                                if (ll->GetFd() > -1)
                                {
                                        bound++;
@@ -123,7 +125,7 @@ int InspIRCd::BindPorts(FailedPortList &failed_ports)
                        n++;
                if (n == ports.end())
                {
-                       this->Logs->Log("SOCKET",ERROR,"Port bindings slipped out of vector, aborting close!");
+                       this->Logs->Log("SOCKET",DEFAULT,"Port bindings slipped out of vector, aborting close!");
                        break;
                }