From 42e85d921b0c5e10889d93c24b7ebf355287ee71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 16 Nov 2016 23:07:27 +0100 Subject: Remove some useless virtual method from SocketHandler --- louloulibs/network/dns_socket_handler.cpp | 9 --------- louloulibs/network/dns_socket_handler.hpp | 6 ------ louloulibs/network/socket_handler.hpp | 7 +++---- louloulibs/network/tcp_client_socket_handler.hpp | 2 +- louloulibs/network/tcp_server_socket.hpp | 12 ------------ louloulibs/network/tcp_socket_handler.hpp | 1 + 6 files changed, 5 insertions(+), 32 deletions(-) (limited to 'louloulibs/network') diff --git a/louloulibs/network/dns_socket_handler.cpp b/louloulibs/network/dns_socket_handler.cpp index af39f49..a69f59b 100644 --- a/louloulibs/network/dns_socket_handler.cpp +++ b/louloulibs/network/dns_socket_handler.cpp @@ -15,10 +15,6 @@ DNSSocketHandler::DNSSocketHandler(std::shared_ptr poller, { } -void DNSSocketHandler::connect() -{ -} - void DNSSocketHandler::on_recv() { // always stop watching send and read events. We will re-watch them if the @@ -40,11 +36,6 @@ bool DNSSocketHandler::is_connected() const return true; } -bool DNSSocketHandler::is_connecting() const -{ - return false; -} - void DNSSocketHandler::remove_from_poller() { if (this->poller->is_managing_socket(this->socket)) diff --git a/louloulibs/network/dns_socket_handler.hpp b/louloulibs/network/dns_socket_handler.hpp index 14ba177..e3fed0c 100644 --- a/louloulibs/network/dns_socket_handler.hpp +++ b/louloulibs/network/dns_socket_handler.hpp @@ -31,16 +31,10 @@ public: */ void on_recv() override final; void on_send() override final; - /** - * Do nothing, because we are always considered to be connected, since the - * connection is done by c-ares and not by us. - */ - void connect() override final; /** * Always true, see the comment for connect() */ bool is_connected() const override final; - bool is_connecting() const override final; void remove_from_poller(); private: diff --git a/louloulibs/network/socket_handler.hpp b/louloulibs/network/socket_handler.hpp index 02e3b80..607a106 100644 --- a/louloulibs/network/socket_handler.hpp +++ b/louloulibs/network/socket_handler.hpp @@ -20,11 +20,10 @@ public: SocketHandler& operator=(const SocketHandler&) = delete; SocketHandler& operator=(SocketHandler&&) = delete; - virtual void on_recv() = 0; - virtual void on_send() = 0; - virtual void connect() = 0; + virtual void on_recv() {} + virtual void on_send() {} + virtual void connect() {} virtual bool is_connected() const = 0; - virtual bool is_connecting() const = 0; socket_t get_socket() const { return this->socket; } diff --git a/louloulibs/network/tcp_client_socket_handler.hpp b/louloulibs/network/tcp_client_socket_handler.hpp index 3ad8ec3..72f68d0 100644 --- a/louloulibs/network/tcp_client_socket_handler.hpp +++ b/louloulibs/network/tcp_client_socket_handler.hpp @@ -24,7 +24,7 @@ class TCPClientSocketHandler: public TCPSocketHandler */ virtual void on_connected() = 0; bool is_connected() const override; - bool is_connecting() const; + bool is_connecting() const override; std::string get_port() const; diff --git a/louloulibs/network/tcp_server_socket.hpp b/louloulibs/network/tcp_server_socket.hpp index 44d474c..7ea49ab 100644 --- a/louloulibs/network/tcp_server_socket.hpp +++ b/louloulibs/network/tcp_server_socket.hpp @@ -63,20 +63,8 @@ class TcpSocketServer: public SocketHandler { this->poller->add_socket_handler(this); } - void on_send() override - { - assert(false); - } - void connect() override - { - assert(false); - } bool is_connected() const override { return true; } - bool is_connecting() const override - { - return false; - } }; diff --git a/louloulibs/network/tcp_socket_handler.hpp b/louloulibs/network/tcp_socket_handler.hpp index d5e24ee..85c30f5 100644 --- a/louloulibs/network/tcp_socket_handler.hpp +++ b/louloulibs/network/tcp_socket_handler.hpp @@ -105,6 +105,7 @@ private: #ifdef BOTAN_FOUND protected: + virtual bool is_connecting() const = 0; /** * Create the TLS::Client object, with all the callbacks etc. This must be * called only when we know we are able to send TLS-encrypted data over -- cgit v1.2.3