mirror of
https://github.com/znc/znc.git
synced 2026-08-10 19:02:51 +02:00
Update Csocket to e00323f9f18
This breaks API for Csock::SockError()! Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
+842
-799
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -536,7 +536,7 @@ bool CHTTPSock::Redirect(const CString& sURL) {
|
||||
void CHTTPSock::Timeout() {
|
||||
}
|
||||
|
||||
void CHTTPSock::SockError(int iErrno) {
|
||||
void CHTTPSock::SockError(int iErrno, const CString& sDescription) {
|
||||
}
|
||||
|
||||
void CHTTPSock::Connected() {
|
||||
|
||||
+3
-17
@@ -953,22 +953,8 @@ void CIRCSock::Disconnected() {
|
||||
m_scUserModes.clear();
|
||||
}
|
||||
|
||||
void CIRCSock::SockError(int iErrno) {
|
||||
CString sError;
|
||||
|
||||
if (iErrno == EDOM) {
|
||||
sError = "Your bind host could not be resolved";
|
||||
} else if (iErrno == EADDRNOTAVAIL) {
|
||||
// Csocket uses this if it can't resolve the dest host name
|
||||
// ...but it also does generate this if bind() fails -.-
|
||||
sError = strerror(iErrno);
|
||||
if (GetBindHost().empty())
|
||||
sError += " (Is your IRC server's host name valid?)";
|
||||
else
|
||||
sError += " (Is your IRC server's host name and ZNC bind host valid?)";
|
||||
} else {
|
||||
sError = strerror(iErrno);
|
||||
}
|
||||
void CIRCSock::SockError(int iErrno, const CString& sDescription) {
|
||||
CString sError = sDescription;
|
||||
|
||||
DEBUG(GetSockName() << " == SockError(" << iErrno << " "
|
||||
<< sError << ")");
|
||||
@@ -976,7 +962,7 @@ void CIRCSock::SockError(int iErrno) {
|
||||
if (GetConState() != CST_OK) {
|
||||
m_pNetwork->PutStatus("Cannot connect to IRC (" + sError + "). Retrying...");
|
||||
} else {
|
||||
m_pNetwork->PutStatus("Disconnected from IRC (" + sError + "). Reconnecting...");
|
||||
m_pNetwork->PutStatus("Disconnected from IRC (" + sError + "). Reconnecting...");
|
||||
}
|
||||
}
|
||||
m_pNetwork->ClearRawBuffer();
|
||||
|
||||
+2
-2
@@ -64,8 +64,8 @@ Csock* CRealListener::GetSockObj(const CString& sHost, unsigned short uPort) {
|
||||
return pClient;
|
||||
}
|
||||
|
||||
void CRealListener::SockError(int iErrno) {
|
||||
DEBUG(GetSockName() << " == SockError(" << strerror(iErrno) << ")");
|
||||
void CRealListener::SockError(int iErrno, const CString& sDescription) {
|
||||
DEBUG(GetSockName() << " == SockError(" << sDescription << ", " << strerror(iErrno) << ")");
|
||||
if (iErrno == EMFILE) {
|
||||
// We have too many open fds, let's close this listening port to be able to continue
|
||||
// to work, next rehash will (try to) reopen it.
|
||||
|
||||
+7
-6
@@ -29,10 +29,11 @@ unsigned int CSockManager::GetAnonConnectionCount(const CString &sIP) const {
|
||||
return ret;
|
||||
}
|
||||
|
||||
CS_STRING CZNCSock::ConvertAddress(void *addr, bool ipv6) {
|
||||
CString sRet = Csock::ConvertAddress(addr, ipv6);
|
||||
sRet.TrimPrefix("::ffff:");
|
||||
return sRet;
|
||||
int CZNCSock::ConvertAddress(const struct sockaddr_storage * pAddr, socklen_t iAddrLen, CS_STRING & sIP, u_short * piPort) {
|
||||
int ret = Csock::ConvertAddress(pAddr, iAddrLen, sIP, piPort);
|
||||
if (ret == 0)
|
||||
sIP.TrimPrefix("::ffff:");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/////////////////// CSocket ///////////////////
|
||||
@@ -74,8 +75,8 @@ void CSocket::ReachedMaxBuffer() {
|
||||
Close();
|
||||
}
|
||||
|
||||
void CSocket::SockError(int iErrno) {
|
||||
DEBUG(GetSockName() << " == SockError(" << strerror(iErrno) << ")");
|
||||
void CSocket::SockError(int iErrno, const CString& sDescription) {
|
||||
DEBUG(GetSockName() << " == SockError(" << sDescription << ", " << strerror(iErrno) << ")");
|
||||
if (iErrno == EMFILE) {
|
||||
// We have too many open fds, this can cause a busy loop.
|
||||
Close();
|
||||
|
||||
Reference in New Issue
Block a user