summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-01 22:55:39 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-01 22:55:39 +0000
commit50eebfeac8ebe501b021ebf62b0b01464fd79a21 (patch)
tree85c26ff8bdbacd6e3b43cc68bd78fd22ba892420 /src
parentc9fed3cb0d87aabbb440f6a14a72601a7f99e8e9 (diff)
Move list of open ports out of Config object
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11423 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_stats.cpp8
-rw-r--r--src/dns.cpp2
-rw-r--r--src/inspircd.cpp8
-rw-r--r--src/socket.cpp12
4 files changed, 15 insertions, 15 deletions
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index 09a6c4394..4af8dcb91 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -82,14 +82,14 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str
/* stats p (show listening ports and registered clients on each) */
case 'p':
{
- for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++)
+ for (size_t i = 0; i < ServerInstance->ports.size(); i++)
{
- std::string ip = ServerInstance->Config->ports[i]->GetIP();
+ std::string ip = ServerInstance->ports[i]->GetIP();
if (ip.empty())
ip.assign("*");
- results.push_back(sn+" 249 "+user->nick+" :"+ ip + ":"+ConvToStr(ServerInstance->Config->ports[i]->GetPort())+" (client, " +
- ServerInstance->Config->ports[i]->GetDescription() + ")");
+ results.push_back(sn+" 249 "+user->nick+" :"+ ip + ":"+ConvToStr(ServerInstance->ports[i]->GetPort())+" (client, " +
+ ServerInstance->ports[i]->GetDescription() + ")");
}
}
break;
diff --git a/src/dns.cpp b/src/dns.cpp
index ed2eff2bb..75108d577 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -1162,6 +1162,6 @@ unsigned long DNS::PRNG()
gettimeofday(&n,NULL);
val = (n.tv_usec ^ (getpid() ^ geteuid()) ^ ((this->currid++)) ^ s->statsAccept) + n.tv_sec;
val = val + (s->statsCollisions ^ s->statsDnsGood) - s->statsDnsBad;
- val += (s->statsConnects ^ (unsigned long)s->statsSent ^ (unsigned long)s->statsRecv) - ServerInstance->Config->ports.size();
+ val += (s->statsConnects ^ (unsigned long)s->statsSent ^ (unsigned long)s->statsRecv) - ServerInstance->ports.size();
return val;
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 23ef19aef..630216d6e 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -95,13 +95,13 @@ void InspIRCd::Cleanup()
{
if (Config)
{
- for (unsigned int i = 0; i < Config->ports.size(); i++)
+ for (unsigned int i = 0; i < ports.size(); i++)
{
/* This calls the constructor and closes the listening socket */
- delete Config->ports[i];
+ delete ports[i];
}
- Config->ports.clear();
+ ports.clear();
}
/* Close all client sockets, or the new process inherits them */
@@ -628,7 +628,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
this->BuildISupport();
InitializeDisabledCommands(Config->DisabledCommands, this);
- if (Config->ports.size() != (unsigned int)found_ports)
+ if (ports.size() != (unsigned int)found_ports)
{
printf("\nWARNING: Not all your client ports could be bound --\nstarting anyway with %d of %d client ports bound.\n\n", bounditems, found_ports);
printf("The following port(s) failed to bind:\n");
diff --git a/src/socket.cpp b/src/socket.cpp
index cdf624321..35feda01f 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -183,11 +183,11 @@ int InspIRCd::BindPorts(bool, int &ports_found, FailedPortList &failed_ports)
{
char configToken[MAXBUF], Addr[MAXBUF], Type[MAXBUF];
int bound = 0;
- bool started_with_nothing = (Config->ports.size() == 0);
+ bool started_with_nothing = (ports.size() == 0);
std::vector<std::pair<std::string, int> > old_ports;
/* XXX: Make a copy of the old ip/port pairs here */
- for (std::vector<ListenSocketBase *>::iterator o = Config->ports.begin(); o != Config->ports.end(); ++o)
+ for (std::vector<ListenSocketBase *>::iterator o = ports.begin(); o != ports.end(); ++o)
old_ports.push_back(make_pair((*o)->GetIP(), (*o)->GetPort()));
for (int count = 0; count < Config->ConfValueEnum(Config->config_data, "bind"); count++)
@@ -209,7 +209,7 @@ int InspIRCd::BindPorts(bool, int &ports_found, FailedPortList &failed_ports)
*Addr = 0;
bool skip = false;
- for (std::vector<ListenSocketBase *>::iterator n = Config->ports.begin(); n != Config->ports.end(); ++n)
+ for (std::vector<ListenSocketBase *>::iterator n = ports.begin(); n != ports.end(); ++n)
{
if (((*n)->GetIP() == Addr) && ((*n)->GetPort() == portno))
{
@@ -231,7 +231,7 @@ int InspIRCd::BindPorts(bool, int &ports_found, FailedPortList &failed_ports)
if (ll->GetFd() > -1)
{
bound++;
- Config->ports.push_back(ll);
+ ports.push_back(ll);
}
else
{
@@ -248,13 +248,13 @@ int InspIRCd::BindPorts(bool, int &ports_found, FailedPortList &failed_ports)
{
for (size_t k = 0; k < old_ports.size(); ++k)
{
- for (std::vector<ListenSocketBase *>::iterator n = Config->ports.begin(); n != Config->ports.end(); ++n)
+ for (std::vector<ListenSocketBase *>::iterator n = ports.begin(); n != ports.end(); ++n)
{
if (((*n)->GetIP() == old_ports[k].first) && ((*n)->GetPort() == old_ports[k].second))
{
this->Logs->Log("SOCKET",DEFAULT,"Port binding %s:%d was removed from the config file, closing.", old_ports[k].first.c_str(), old_ports[k].second);
delete *n;
- Config->ports.erase(n);
+ ports.erase(n);
break;
}
}