Remove some useless virtual method from SocketHandler

This commit is contained in:
louiz’
2016-11-16 23:07:27 +01:00
parent b5a7c66bea
commit 42e85d921b
6 changed files with 5 additions and 32 deletions
@@ -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))
@@ -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:
+3 -4
View File
@@ -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; }
@@ -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;
-12
View File
@@ -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;
}
};
@@ -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