mirror of
https://github.com/znc/znc.git
synced 2026-08-07 09:22:55 +02:00
Merge branch '1.6.x'
This commit is contained in:
@@ -155,12 +155,15 @@ class CSockManager : public TSocketManager<CZNCSock> {
|
||||
const CString& sBindHost = "", CZNCSock* pcSock = nullptr);
|
||||
|
||||
unsigned int GetAnonConnectionCount(const CString& sIP) const;
|
||||
void DelSockByAddr(Csock* pcSock) override;
|
||||
|
||||
private:
|
||||
void FinishConnect(const CString& sHostname, u_short iPort,
|
||||
const CString& sSockName, int iTimeout, bool bSSL,
|
||||
const CString& sBindHost, CZNCSock* pcSock);
|
||||
|
||||
std::map<Csock*, bool /* deleted */> m_InFlightDnsSockets;
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
class CThreadMonitorFD;
|
||||
friend class CThreadMonitorFD;
|
||||
|
||||
@@ -392,6 +392,7 @@ CSockManager::~CSockManager() {}
|
||||
void CSockManager::Connect(const CString& sHostname, u_short iPort,
|
||||
const CString& sSockName, int iTimeout, bool bSSL,
|
||||
const CString& sBindHost, CZNCSock* pcSock) {
|
||||
m_InFlightDnsSockets[pcSock] = false;
|
||||
if (pcSock) {
|
||||
pcSock->SetHostToVerifySSL(sHostname);
|
||||
}
|
||||
@@ -423,6 +424,20 @@ void CSockManager::FinishConnect(const CString& sHostname, u_short iPort,
|
||||
const CString& sSockName, int iTimeout,
|
||||
bool bSSL, const CString& sBindHost,
|
||||
CZNCSock* pcSock) {
|
||||
auto it = m_InFlightDnsSockets.find(pcSock);
|
||||
if (it != m_InFlightDnsSockets.end()) {
|
||||
bool bSocketDeletedAlready = it->second;
|
||||
m_InFlightDnsSockets.erase(it);
|
||||
if (bSocketDeletedAlready) {
|
||||
DEBUG("TDNS: Socket ["
|
||||
<< sSockName
|
||||
<< "] is deleted already, not proceeding with connection");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// impossible
|
||||
}
|
||||
|
||||
CSConnection C(sHostname, iPort, iTimeout);
|
||||
|
||||
C.SetSockName(sSockName);
|
||||
@@ -439,6 +454,16 @@ void CSockManager::FinishConnect(const CString& sHostname, u_short iPort,
|
||||
TSocketManager<CZNCSock>::Connect(C, pcSock);
|
||||
}
|
||||
|
||||
void CSockManager::DelSockByAddr(Csock* pcSock) {
|
||||
auto it = m_InFlightDnsSockets.find(pcSock);
|
||||
if (it != m_InFlightDnsSockets.end()) {
|
||||
// The socket is resolving its DNS. When that finishes, let it silently
|
||||
// die without crash.
|
||||
it->second = true;
|
||||
}
|
||||
TSocketManager<CZNCSock>::DelSockByAddr(pcSock);
|
||||
}
|
||||
|
||||
/////////////////// CSocket ///////////////////
|
||||
CSocket::CSocket(CModule* pModule) : CZNCSock(), m_pModule(pModule) {
|
||||
if (m_pModule) m_pModule->AddSocket(this);
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ else
|
||||
|
||||
# Figure out the information we need
|
||||
LATEST_TAG=`${GIT} describe --abbrev=0 HEAD`
|
||||
COMMITS_SINCE=`${GIT} log --format=oneline ${LATEST_TAG}..HEAD | wc -l`
|
||||
COMMITS_SINCE=`${GIT} log --pretty=oneline ${LATEST_TAG}..HEAD | wc -l`
|
||||
# Explicitly make it a number: on openbsd wc -l returns " 42" instead of "42"
|
||||
let COMMITS_SINCE=COMMITS_SINCE
|
||||
SHORT_ID=`${GIT} rev-parse --short HEAD`
|
||||
|
||||
Reference in New Issue
Block a user