Remove unnecessary overloading from pqissllistener

This commit is contained in:
Gio 2015-10-30 13:20:43 +01:00
parent bb7cfc6387
commit 8936dafe4d
2 changed files with 43 additions and 67 deletions

View File

@ -56,19 +56,17 @@ const int pqissllistenzone = 49787;
*/
pqissllistenbase::pqissllistenbase(const struct sockaddr_storage &addr, p3PeerMgr *pm)
:laddr(addr), active(false), mPeerMgr(pm)
pqissllistenbase::pqissllistenbase(const sockaddr_storage &addr, p3PeerMgr *pm)
: laddr(addr), active(false), mPeerMgr(pm)
{
if (!(AuthSSL::getAuthSSL()-> active())) {
pqioutput(PQL_ALERT, pqissllistenzone,
"SSL-CTX-CERT-ROOT not initialised!");
if (!(AuthSSL::getAuthSSL()-> active()))
{
pqioutput(PQL_ALERT, pqissllistenzone,
"SSL-CTX-CERT-ROOT not initialised!");
exit(1);
}
setuplisten();
return;
}
pqissllistenbase::~pqissllistenbase()
@ -730,18 +728,7 @@ int pqissllistenbase::isSSLActive(int /*fd*/, SSL *ssl)
*
*/
pqissllistener::pqissllistener(const struct sockaddr_storage &addr, p3PeerMgr *lm)
:pqissllistenbase(addr, lm)
{
return;
}
pqissllistener::~pqissllistener()
{
return;
}
int pqissllistener::addlistenaddr(const RsPeerId& id, pqissl *acc)
int pqissllistener::addlistenaddr(const RsPeerId& id, pqissl *acc)
{
std::map<RsPeerId, pqissl *>::iterator it;
@ -755,7 +742,6 @@ int pqissllistener::addlistenaddr(const RsPeerId& id, pqissl *acc)
pqioutput(PQL_DEBUG_ALERT, pqissllistenzone, out);
return -1;
}
}
@ -792,7 +778,7 @@ int pqissllistener::removeListenPort(const RsPeerId& id)
}
int pqissllistener::status()
int pqissllistener::status()
{
pqissllistenbase::status();
// print certificates we are listening for.

View File

@ -67,20 +67,18 @@ public:
pqissllistenbase(const struct sockaddr_storage &addr, p3PeerMgr *pm);
virtual ~pqissllistenbase();
/*************************************/
/* LISTENER INTERFACE **/
/*************************************/
/* LISTENER INTERFACE */
virtual int tick();
virtual int status();
virtual int setListenAddr(const struct sockaddr_storage &addr);
virtual int setuplisten();
virtual int resetlisten();
/*************************************/
virtual int tick();
virtual int status();
virtual int setListenAddr(const struct sockaddr_storage &addr);
virtual int setuplisten();
virtual int resetlisten();
/*************************************/
int acceptconnection();
int continueaccepts();
int finaliseAccepts();
int acceptconnection();
int continueaccepts();
int finaliseAccepts();
struct IncomingSSLInfo
{
@ -92,52 +90,44 @@ int finaliseAccepts();
};
// fn to get cert, anyway
int continueSSL(IncomingSSLInfo&, bool);
int closeConnection(int fd, SSL *ssl);
int isSSLActive(int fd, SSL *ssl);
int continueSSL(IncomingSSLInfo&, bool);
int closeConnection(int fd, SSL *ssl);
int isSSLActive(int fd, SSL *ssl);
virtual int completeConnection(int sockfd, IncomingSSLInfo&) = 0;
virtual int finaliseConnection(int fd, SSL *ssl, const RsPeerId& peerId, const struct sockaddr_storage &raddr) = 0;
protected:
virtual int completeConnection(int sockfd, IncomingSSLInfo&) = 0;
virtual int finaliseConnection(int fd, SSL *ssl, const RsPeerId& peerId,
const sockaddr_storage &raddr) = 0;
protected:
struct sockaddr_storage laddr;
std::list<AcceptedSSL> accepted_ssl;
private:
int Extract_Failed_SSL_Certificate(const IncomingSSLInfo&);
bool active;
int lsock;
std::list<IncomingSSLInfo> incoming_ssl ;
protected:
p3PeerMgr *mPeerMgr;
private:
int Extract_Failed_SSL_Certificate(const IncomingSSLInfo&);
bool active;
int lsock;
std::list<IncomingSSLInfo> incoming_ssl ;
};
class pqissllistener: public pqissllistenbase
{
public:
public:
pqissllistener(const struct sockaddr_storage &addr, p3PeerMgr *pm) :
pqissllistenbase(addr, pm) {}
virtual ~pqissllistener() {}
pqissllistener(const struct sockaddr_storage &addr, p3PeerMgr *pm);
virtual ~pqissllistener();
int addlistenaddr(const RsPeerId& id, pqissl *acc);
int removeListenPort(const RsPeerId& id);
int addlistenaddr(const RsPeerId& id, pqissl *acc);
int removeListenPort(const RsPeerId& id);
virtual int status();
virtual int completeConnection(int sockfd, IncomingSSLInfo&);
virtual int finaliseConnection(int fd, SSL *ssl, const RsPeerId& peerId,
const sockaddr_storage &raddr);
//virtual int tick();
virtual int status();
virtual int completeConnection(int sockfd, IncomingSSLInfo&);
virtual int finaliseConnection(int fd, SSL *ssl, const RsPeerId& peerId, const struct sockaddr_storage &raddr);
private:
std::map<RsPeerId, pqissl *> listenaddr;
private:
std::map<RsPeerId, pqissl*> listenaddr;
};