mirror of
https://github.com/znc/znc.git
synced 2026-06-30 06:51:26 +02:00
Add traffic tracking support to CSocket
Now every module that uses CSocket automatically gets its generated traffic counted. Those which use Csock directly should be shot and burried anyway ;) This adds CModule::IsGlobal(). git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1283 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+12
@@ -114,7 +114,17 @@ CSocket::CSocket(CModule* pModule, const CString& sHostname, unsigned short uPor
|
||||
}
|
||||
|
||||
CSocket::~CSocket() {
|
||||
CUser *pUser = m_pModule->GetUser();
|
||||
|
||||
m_pModule->UnlinkSocket(this);
|
||||
|
||||
if (!m_pModule->IsGlobal() && pUser) {
|
||||
pUser->AddBytesWritten(GetBytesWritten());
|
||||
pUser->AddBytesRead(GetBytesRead());
|
||||
} else {
|
||||
CZNC::Get().AddBytesWritten(GetBytesWritten());
|
||||
CZNC::Get().AddBytesRead(GetBytesRead());
|
||||
}
|
||||
}
|
||||
|
||||
void CSocket::ReachedMaxBuffer() {
|
||||
@@ -181,6 +191,7 @@ CModule* CSocket::GetModule() const { return m_pModule; }
|
||||
|
||||
CModule::CModule(void* pDLL, CUser* pUser, const CString& sModName, const CString& sDataDir) {
|
||||
m_bFake = false;
|
||||
m_bGlobal = false;
|
||||
m_pDLL = pDLL;
|
||||
m_pManager = &(CZNC::Get().GetManager());;
|
||||
m_pUser = pUser;
|
||||
@@ -779,6 +790,7 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CUser* p
|
||||
}
|
||||
|
||||
pModule->SetDescription(GetDesc());
|
||||
pModule->SetGlobal(bIsGlobal);
|
||||
push_back(pModule);
|
||||
|
||||
bool bLoaded;
|
||||
|
||||
Reference in New Issue
Block a user