Permalink
Browse files

The Listener of a RealListener is never NULL

  • Loading branch information...
1 parent 7a9ce63 commit d3ddb9b69dd1692d361b263d73674eb70f12a525 @uu1101 uu1101 committed Feb 15, 2014
Showing with 5 additions and 5 deletions.
  1. +2 −2 include/znc/Listener.h
  2. +3 −3 src/Listener.cpp
View
@@ -71,15 +71,15 @@ class CListener {
class CRealListener : public CZNCSock {
public:
- CRealListener(CListener *pParent) : CZNCSock(), m_pParent(pParent) {}
+ CRealListener(CListener& listener) : CZNCSock(), m_Listener(listener) {}
virtual ~CRealListener();
virtual bool ConnectionFrom(const CString& sHost, unsigned short uPort);
virtual Csock* GetSockObj(const CString& sHost, unsigned short uPort);
virtual void SockError(int iErrno, const CString& sDescription);
private:
- CListener* m_pParent;
+ CListener& m_Listener;
};
class CIncomingConnection : public CZNCSock {
View
@@ -27,7 +27,7 @@ bool CListener::Listen() {
return false;
}
- m_pListener = new CRealListener(this);
+ m_pListener = new CRealListener(*this);
bool bSSL = false;
#ifdef HAVE_LIBSSL
@@ -50,7 +50,7 @@ void CListener::ResetRealListener() {
}
CRealListener::~CRealListener() {
- m_pParent->ResetRealListener();
+ m_Listener.ResetRealListener();
}
bool CRealListener::ConnectionFrom(const CString& sHost, unsigned short uPort) {
@@ -60,7 +60,7 @@ bool CRealListener::ConnectionFrom(const CString& sHost, unsigned short uPort) {
}
Csock* CRealListener::GetSockObj(const CString& sHost, unsigned short uPort) {
- CIncomingConnection *pClient = new CIncomingConnection(sHost, uPort, m_pParent->GetAcceptType());
+ CIncomingConnection *pClient = new CIncomingConnection(sHost, uPort, m_Listener.GetAcceptType());
if (CZNC::Get().AllowConnectionFrom(sHost)) {
GLOBALMODULECALL(OnClientConnect(pClient, sHost, uPort), NOTHING);
} else {

0 comments on commit d3ddb9b

Please sign in to comment.