]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socket.cpp
Untested! New m_watch that should be hundreds of times faster (im not joking either)
[user/henk/code/inspircd.git] / src / socket.cpp
index b68de7159764198b90325539934ea8f80883625d..d5ad7b4ce6cd5e4a68e3440343ea81c058de47a2 100644 (file)
@@ -389,7 +389,7 @@ bool InspIRCd::HasPort(int port, char* addr)
 }
 
 /* XXX: Probably belongs in class InspIRCd */
-int InspIRCd::BindPorts(bool bail, int &ports_found)
+int InspIRCd::BindPorts(bool bail, int &ports_found, FailedPortList &failed_ports)
 {
        char configToken[MAXBUF], Addr[MAXBUF], Type[MAXBUF];
        insp_sockaddr client, server;
@@ -409,9 +409,9 @@ int InspIRCd::BindPorts(bool bail, int &ports_found)
 
                if ((!*Type) || (!strcmp(Type,"clients")))
                {
-                       irc::portparser portrange(configToken);
+                       irc::portparser portrange(configToken, false);
                        long portno = -1;
-                       while (portno = portrange.GetToken())
+                       while ((portno = portrange.GetToken()))
                        {
                                if (!HasPort(portno, Addr))
                                {
@@ -439,6 +439,7 @@ int InspIRCd::BindPorts(bool bail, int &ports_found)
                                        if (fd == ERROR)
                                        {
                                                this->Log(DEBUG,"Bad fd %d binding port [%s:%d]",fd,Config->addrs[count],Config->ports[count]);
+                                               failed_ports.push_back(std::make_pair(Config->addrs[count],Config->ports[count]));
                                        }
                                        else
                                        {
@@ -451,6 +452,7 @@ int InspIRCd::BindPorts(bool bail, int &ports_found)
                                                                shutdown(Config->openSockfd[BoundPortCount]->GetFd(),2);
                                                                close(Config->openSockfd[BoundPortCount]->GetFd());
                                                                delete Config->openSockfd[BoundPortCount];
+                                                               failed_ports.push_back(std::make_pair(Config->addrs[count],Config->ports[count]));
                                                        }
                                                        else
                                                                BoundPortCount++;
@@ -475,6 +477,7 @@ int InspIRCd::BindPorts(bool bail, int &ports_found)
                if (fd == ERROR)
                {
                        this->Log(DEBUG,"Bad fd %d binding port [%s:%d]",fd,Config->addrs[count],Config->ports[count]);
+                       failed_ports.push_back(std::make_pair(Config->addrs[count],Config->ports[count]));
                }
                else
                {
@@ -483,6 +486,8 @@ int InspIRCd::BindPorts(bool bail, int &ports_found)
                        {
                                BoundPortCount++;
                        }
+                       else
+                               failed_ports.push_back(std::make_pair(Config->addrs[count],Config->ports[count]));
                }
        }
        return BoundPortCount;