summaryrefslogtreecommitdiff
path: root/src/inspircd.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/inspircd.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/inspircd.cpp')
-rw-r--r--src/inspircd.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 9521f1b22..f182f7169 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -183,6 +183,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
: ModCount(-1), duration_m(60), duration_h(60*60), duration_d(60*60*24), duration_w(60*60*24*7), duration_y(60*60*24*365)
{
int found_ports = 0;
+ FailedPortList pl;
modules.resize(255);
factory.resize(255);
@@ -260,7 +261,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
this->AddServerName(Config->ServerName);
CheckDie();
InitializeDisabledCommands(Config->DisabledCommands, this);
- stats->BoundPortCount = BindPorts(true, found_ports);
+ stats->BoundPortCount = BindPorts(true, found_ports, pl);
for(int t = 0; t < 255; t++)
Config->global_implementation[t] = 0;
@@ -299,7 +300,13 @@ InspIRCd::InspIRCd(int argc, char** argv)
if (stats->BoundPortCount != (unsigned int)found_ports)
{
- printf("\nWARNING: Not all your client ports could be bound --\n starting anyway with %ld of %d client ports bound.\n", stats->BoundPortCount, found_ports);
+ printf("\nWARNING: Not all your client ports could be bound --\nstarting anyway with %ld of %d client ports bound.\n\n", stats->BoundPortCount, found_ports);
+ printf("The following %lu port%s failed to bind:\n", found_ports - stats->BoundPortCount, found_ports - stats->BoundPortCount != 1 ? "s" : "");
+ int j = 1;
+ for (FailedPortList::iterator i = pl.begin(); i != pl.end(); i++, j++)
+ {
+ printf("%d.\tIP: %s\tPort: %lu\n", j, i->first.empty() ? "<all>" : i->first.c_str(), (unsigned long)i->second);
+ }
}
/* Add the listening sockets used for client inbound connections