From 128af8e8938d4a3c8ae95c8fa35a7b0fbab9741e Mon Sep 17 00:00:00 2001 From: psychon Date: Thu, 30 Dec 2010 21:11:40 +0000 Subject: [PATCH] Improve debug output for ISpoof We now generate a DEBUG() message for all errors during ISpoof. Also, the message from *status "ISpoof could not be written" now includes the expanded ISpoofFile that we tried writing to. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2221 726aef4b-f618-498e-8847-2d620e286838 --- znc.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/znc.cpp b/znc.cpp index 2414856a..59c3ed04 100644 --- a/znc.cpp +++ b/znc.cpp @@ -137,8 +137,8 @@ bool CZNC::ConnectUser(CUser *pUser) { return false; if (!WriteISpoof(pUser)) { - DEBUG("ISpoof could not be written"); - pUser->PutStatus("ISpoof could not be written, retrying..."); + DEBUG("ISpoof [" + m_sISpoofFile + "] could not be written"); + pUser->PutStatus("ISpoof [" + m_sISpoofFile + "] could not be written, retrying..."); return true; } @@ -258,6 +258,7 @@ bool CZNC::WriteISpoof(CUser* pUser) { if (!m_sISpoofFile.empty()) { m_pISpoofLockFile = new CFile; if (!m_pISpoofLockFile->TryExLock(m_sISpoofFile, O_RDWR | O_CREAT)) { + DEBUG("Couldn't open and lock ISpoofFile: " << strerror(errno)); delete m_pISpoofLockFile; m_pISpoofLockFile = NULL; return false; @@ -269,6 +270,7 @@ bool CZNC::WriteISpoof(CUser* pUser) { m_sOrigISpoof = buf; if (!m_pISpoofLockFile->Seek(0) || !m_pISpoofLockFile->Truncate()) { + DEBUG("Couldn't truncate the ISpoofFile: " << strerror(errno)); delete m_pISpoofLockFile; m_pISpoofLockFile = NULL; return false; @@ -281,6 +283,7 @@ bool CZNC::WriteISpoof(CUser* pUser) { if (sData == m_sISpoofFormat) { sData.Replace("%", pUser->GetIdent()); } + DEBUG("Writing [" + sData + "] to ISpoofFile [" + m_sISpoofFile + "]"); m_pISpoofLockFile->Write(sData + "\n"); } return true; @@ -292,7 +295,10 @@ void CZNC::ReleaseISpoof() { if (!m_sISpoofFile.empty()) { if (m_pISpoofLockFile->Seek(0) && m_pISpoofLockFile->Truncate()) { + DEBUG("Writing [" + m_sOrigISpoof + "] to ISpoofFile [" + m_sISpoofFile + "]"); m_pISpoofLockFile->Write(m_sOrigISpoof); + } else { + DEBUG("Error while restoring ISpoof: " << strerror(errno)); } m_sOrigISpoof = "";