summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-12 22:58:48 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-12 22:58:48 +0000
commitb3c2abf41eead7a9aac5820796e9600ced8430df (patch)
treec2fbeb42aae2c48ad71c58f45b275444fc29cfa9 /src/socket.cpp
parentceafaa5e7a3f9c6eb78bf2823212ecff92d393c7 (diff)
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
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp7
1 files changed, 6 insertions, 1 deletions
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;