~singpolyma/biboumi

42e85d921b0c5e10889d93c24b7ebf355287ee71 — louiz’ 7 years ago b5a7c66
Remove some useless virtual method from SocketHandler
M louloulibs/network/dns_socket_handler.cpp => louloulibs/network/dns_socket_handler.cpp +0 -9
@@ 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))

M louloulibs/network/dns_socket_handler.hpp => louloulibs/network/dns_socket_handler.hpp +0 -6
@@ 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:

M louloulibs/network/socket_handler.hpp => louloulibs/network/socket_handler.hpp +3 -4
@@ 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; }

M louloulibs/network/tcp_client_socket_handler.hpp => louloulibs/network/tcp_client_socket_handler.hpp +1 -1
@@ 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;


M louloulibs/network/tcp_server_socket.hpp => louloulibs/network/tcp_server_socket.hpp +0 -12
@@ 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;
  }
};

M louloulibs/network/tcp_socket_handler.hpp => louloulibs/network/tcp_socket_handler.hpp +1 -0
@@ 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