From b3c2abf41eead7a9aac5820796e9600ced8430df Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 12 Nov 2006 22:58:48 +0000 Subject: When some (but not all) of the ports fail to bind on startup, give the user a list of the failed port/ip pairs on the terminal. Other ircds dont do this, and say 'go read the log'. I say if we can output them to a log, why not the screen? :) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5728 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/socket.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/socket.cpp') diff --git a/src/socket.cpp b/src/socket.cpp index 284e51a4a..d5ad7b4ce 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -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; @@ -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; -- cgit v1.2.3