mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
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
This commit is contained in:
10
znc.cpp
10
znc.cpp
@@ -137,8 +137,8 @@ bool CZNC::ConnectUser(CUser *pUser) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!WriteISpoof(pUser)) {
|
if (!WriteISpoof(pUser)) {
|
||||||
DEBUG("ISpoof could not be written");
|
DEBUG("ISpoof [" + m_sISpoofFile + "] could not be written");
|
||||||
pUser->PutStatus("ISpoof could not be written, retrying...");
|
pUser->PutStatus("ISpoof [" + m_sISpoofFile + "] could not be written, retrying...");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,6 +258,7 @@ bool CZNC::WriteISpoof(CUser* pUser) {
|
|||||||
if (!m_sISpoofFile.empty()) {
|
if (!m_sISpoofFile.empty()) {
|
||||||
m_pISpoofLockFile = new CFile;
|
m_pISpoofLockFile = new CFile;
|
||||||
if (!m_pISpoofLockFile->TryExLock(m_sISpoofFile, O_RDWR | O_CREAT)) {
|
if (!m_pISpoofLockFile->TryExLock(m_sISpoofFile, O_RDWR | O_CREAT)) {
|
||||||
|
DEBUG("Couldn't open and lock ISpoofFile: " << strerror(errno));
|
||||||
delete m_pISpoofLockFile;
|
delete m_pISpoofLockFile;
|
||||||
m_pISpoofLockFile = NULL;
|
m_pISpoofLockFile = NULL;
|
||||||
return false;
|
return false;
|
||||||
@@ -269,6 +270,7 @@ bool CZNC::WriteISpoof(CUser* pUser) {
|
|||||||
m_sOrigISpoof = buf;
|
m_sOrigISpoof = buf;
|
||||||
|
|
||||||
if (!m_pISpoofLockFile->Seek(0) || !m_pISpoofLockFile->Truncate()) {
|
if (!m_pISpoofLockFile->Seek(0) || !m_pISpoofLockFile->Truncate()) {
|
||||||
|
DEBUG("Couldn't truncate the ISpoofFile: " << strerror(errno));
|
||||||
delete m_pISpoofLockFile;
|
delete m_pISpoofLockFile;
|
||||||
m_pISpoofLockFile = NULL;
|
m_pISpoofLockFile = NULL;
|
||||||
return false;
|
return false;
|
||||||
@@ -281,6 +283,7 @@ bool CZNC::WriteISpoof(CUser* pUser) {
|
|||||||
if (sData == m_sISpoofFormat) {
|
if (sData == m_sISpoofFormat) {
|
||||||
sData.Replace("%", pUser->GetIdent());
|
sData.Replace("%", pUser->GetIdent());
|
||||||
}
|
}
|
||||||
|
DEBUG("Writing [" + sData + "] to ISpoofFile [" + m_sISpoofFile + "]");
|
||||||
m_pISpoofLockFile->Write(sData + "\n");
|
m_pISpoofLockFile->Write(sData + "\n");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -292,7 +295,10 @@ void CZNC::ReleaseISpoof() {
|
|||||||
|
|
||||||
if (!m_sISpoofFile.empty()) {
|
if (!m_sISpoofFile.empty()) {
|
||||||
if (m_pISpoofLockFile->Seek(0) && m_pISpoofLockFile->Truncate()) {
|
if (m_pISpoofLockFile->Seek(0) && m_pISpoofLockFile->Truncate()) {
|
||||||
|
DEBUG("Writing [" + m_sOrigISpoof + "] to ISpoofFile [" + m_sISpoofFile + "]");
|
||||||
m_pISpoofLockFile->Write(m_sOrigISpoof);
|
m_pISpoofLockFile->Write(m_sOrigISpoof);
|
||||||
|
} else {
|
||||||
|
DEBUG("Error while restoring ISpoof: " << strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sOrigISpoof = "";
|
m_sOrigISpoof = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user