mirror of
https://github.com/znc/znc.git
synced 2026-05-07 22:04:46 +02:00
Merged rev 838,888,890,894,899,900,902-904,926,934,963,984-989 from crox's branch:
- Changes to specfile - define PATH_MAX and RTLD_LOCAL if not defines - compile fixes - SetFileName should not set m_iFD - check for cygwin and do not use -fPIC - replaced if ... elif with case in configure.in - handle 437 reply code - allow disabled channels - use strerror() in CIRCSock::SockError() - added GetUser() to CClient and CIRCSock - added support for traffic accounting - added names to timers git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@806 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -22,6 +22,8 @@ CZNC::CZNC() {
|
||||
m_pISpoofLockFile = NULL;
|
||||
m_uiConnectDelay = 30;
|
||||
SetISpoofFormat(""); // Set ISpoofFormat to default
|
||||
m_uBytesRead = 0;
|
||||
m_uBytesWritten = 0;
|
||||
}
|
||||
|
||||
CZNC::~CZNC() {
|
||||
@@ -110,6 +112,8 @@ int CZNC::Loop() {
|
||||
#ifdef _MODULES
|
||||
pUser->DelModules();
|
||||
#endif
|
||||
AddBytesRead(pUser->BytesRead());
|
||||
AddBytesWritten(pUser->BytesWritten());
|
||||
delete pUser;
|
||||
}
|
||||
|
||||
@@ -1303,3 +1307,22 @@ CZNC& CZNC::Get() {
|
||||
return *pZNC;
|
||||
}
|
||||
|
||||
void CZNC::UpdateTrafficStats() {
|
||||
CSockManager* p = &m_Manager;
|
||||
for (unsigned int a = 0; a < p->size(); a++) {
|
||||
if ((*p)[a]->GetSockName().Left(5) == "IRC::") {
|
||||
CIRCSock *i = (CIRCSock *)(*p)[a];
|
||||
i->GetUser()->AddBytesRead((*p)[a]->GetBytesRead());
|
||||
(*p)[a]->ResetBytesRead();
|
||||
i->GetUser()->AddBytesWritten((*p)[a]->GetBytesWritten());
|
||||
(*p)[a]->ResetBytesWritten();
|
||||
} else if ((*p)[a]->GetSockName().Left(5) == "USR::") {
|
||||
CClient *c = (CClient *)(*p)[a];
|
||||
c->GetUser()->AddBytesRead((*p)[a]->GetBytesRead());
|
||||
(*p)[a]->ResetBytesRead();
|
||||
c->GetUser()->AddBytesWritten((*p)[a]->GetBytesWritten());
|
||||
(*p)[a]->ResetBytesWritten();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user