summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-11-16 23:07:27 +0100
committerlouiz’ <louiz@louiz.org>2016-11-16 23:07:27 +0100
commit42e85d921b0c5e10889d93c24b7ebf355287ee71 (patch)
tree5cb7acf81f0d82038e38f02a4b36a9193f61d95a
parentb5a7c66bea8f0bced4bb4ce5c52f17bc30317ec4 (diff)
downloadbiboumi-42e85d921b0c5e10889d93c24b7ebf355287ee71.tar.gz
biboumi-42e85d921b0c5e10889d93c24b7ebf355287ee71.tar.bz2
biboumi-42e85d921b0c5e10889d93c24b7ebf355287ee71.tar.xz
biboumi-42e85d921b0c5e10889d93c24b7ebf355287ee71.zip
Remove some useless virtual method from SocketHandler
-rw-r--r--louloulibs/network/dns_socket_handler.cpp9
-rw-r--r--louloulibs/network/dns_socket_handler.hpp6
-rw-r--r--louloulibs/network/socket_handler.hpp7
-rw-r--r--louloulibs/network/tcp_client_socket_handler.hpp2
-rw-r--r--louloulibs/network/tcp_server_socket.hpp12
-rw-r--r--louloulibs/network/tcp_socket_handler.hpp1
6 files changed, 5 insertions, 32 deletions
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> 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
@@ -32,15 +32,9 @@ 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