From 8936dafe4d811af355ca3eb268976ed26ed1b9d9 Mon Sep 17 00:00:00 2001 From: Gio Date: Fri, 30 Oct 2015 13:20:43 +0100 Subject: [PATCH] Remove unnecessary overloading from pqissllistener --- libretroshare/src/pqi/pqissllistener.cc | 30 +++------- libretroshare/src/pqi/pqissllistener.h | 80 +++++++++++-------------- 2 files changed, 43 insertions(+), 67 deletions(-) diff --git a/libretroshare/src/pqi/pqissllistener.cc b/libretroshare/src/pqi/pqissllistener.cc index 12cd3adc5..7426d9799 100644 --- a/libretroshare/src/pqi/pqissllistener.cc +++ b/libretroshare/src/pqi/pqissllistener.cc @@ -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::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. diff --git a/libretroshare/src/pqi/pqissllistener.h b/libretroshare/src/pqi/pqissllistener.h index e3a99b7bb..b5de39069 100644 --- a/libretroshare/src/pqi/pqissllistener.h +++ b/libretroshare/src/pqi/pqissllistener.h @@ -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 accepted_ssl; - - private: - - int Extract_Failed_SSL_Certificate(const IncomingSSLInfo&); - - bool active; - int lsock; - - std::list incoming_ssl ; - - protected: - p3PeerMgr *mPeerMgr; +private: + int Extract_Failed_SSL_Certificate(const IncomingSSLInfo&); + bool active; + int lsock; + std::list 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 listenaddr; +private: + std::map listenaddr; };