Change stats recv/send to double, so they can hold truly massive numbers of transferred bytes (they would overflow after about 6 weeks on a busy net otherwise)

Fix some warnings


git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4450 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2006-07-19 15:03:26 +00:00
parent 250c92805c
commit 69ae63ecd2
4 changed files with 12 additions and 11 deletions

View File

@ -63,15 +63,16 @@ class serverstats : public classbase
unsigned long statsDnsGood;
unsigned long statsDnsBad;
unsigned long statsConnects;
unsigned long statsSent;
unsigned long statsRecv;
double statsSent;
double statsRecv;
unsigned long BoundPortCount;
serverstats()
{
statsAccept = statsRefused = statsUnknown = 0;
statsCollisions = statsDns = statsDnsGood = 0;
statsDnsBad = statsConnects = statsSent = statsRecv = 0;
statsDnsBad = statsConnects = 0;
statsSent = statsRecv = 0.0;
BoundPortCount = 0;
}
};

View File

@ -181,12 +181,12 @@ void cmd_stats::Handle (const char** parameters, int pcnt, userrec *user)
if (*parameters[0] == 'T')
{
WriteServ(user->fd,"249 %s :accepts %d refused %d",user->nick,ServerInstance->stats->statsAccept,ServerInstance->stats->statsRefused);
WriteServ(user->fd,"249 %s :unknown commands %d",user->nick,ServerInstance->stats->statsUnknown);
WriteServ(user->fd,"249 %s :nick collisions %d",user->nick,ServerInstance->stats->statsCollisions);
WriteServ(user->fd,"249 %s :dns requests %d succeeded %d failed %d",user->nick,ServerInstance->stats->statsDns,ServerInstance->stats->statsDnsGood,ServerInstance->stats->statsDnsBad);
WriteServ(user->fd,"249 %s :connections %d",user->nick,ServerInstance->stats->statsConnects);
WriteServ(user->fd,"249 %s :bytes sent %dK recv %dK",user->nick,(ServerInstance->stats->statsSent / 1024),(ServerInstance->stats->statsRecv / 1024));
WriteServ(user->fd,"249 %s :accepts %lu refused %lu",user->nick,ServerInstance->stats->statsAccept,ServerInstance->stats->statsRefused);
WriteServ(user->fd,"249 %s :unknown commands %lu",user->nick,ServerInstance->stats->statsUnknown);
WriteServ(user->fd,"249 %s :nick collisions %lu",user->nick,ServerInstance->stats->statsCollisions);
WriteServ(user->fd,"249 %s :dns requests %lu succeeded %lu failed %lu",user->nick,ServerInstance->stats->statsDns,ServerInstance->stats->statsDnsGood,ServerInstance->stats->statsDnsBad);
WriteServ(user->fd,"249 %s :connections %lu",user->nick,ServerInstance->stats->statsConnects);
WriteServ(user->fd,"249 %s :bytes sent %5.2fK recv %5.2fK",user->nick,ServerInstance->stats->statsSent / 1024,ServerInstance->stats->statsRecv / 1024);
}
/* stats o */

View File

@ -923,7 +923,7 @@ int InspIRCd::Run()
/* Add the listening sockets used for client inbound connections
* to the socket engine
*/
for (int count = 0; count < stats->BoundPortCount; count++)
for (unsigned long count = 0; count < stats->BoundPortCount; count++)
SE->AddFd(Config->openSockfd[count],true,X_LISTEN);
this->WritePID(Config->PID);

View File

@ -119,7 +119,7 @@ int OpenTCPSocket()
bool HasPort(int port, char* addr)
{
for (int count = 0; count < ServerInstance->stats->BoundPortCount; count++)
for (unsigned long count = 0; count < ServerInstance->stats->BoundPortCount; count++)
{
if ((port == Config->ports[count]) && (!strcasecmp(Config->addrs[count],addr)))
{