changeset 671:3a6c8101349e

Common: typo and cleanup
author David Demelier <markand@malikania.fr>
date Tue, 10 Apr 2018 21:23:01 +0200
parents 95ac3ace1610
children 15b25f9e794f
files libcommon/irccd/socket_acceptor.hpp libcommon/irccd/socket_connector.hpp libcommon/irccd/socket_stream.hpp libirccd/irccd/daemon/transport_client.hpp libirccd/irccd/daemon/transport_server.hpp libirccdctl/irccd/ctl/controller.hpp
diffstat 6 files changed, 27 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/libcommon/irccd/socket_acceptor.hpp	Tue Apr 10 21:20:30 2018 +0200
+++ b/libcommon/irccd/socket_acceptor.hpp	Tue Apr 10 21:23:01 2018 +0200
@@ -117,6 +117,8 @@
 {
 #if !defined(NDEBUG)
     assert(!is_accepting_);
+
+    is_accepting_ = true;
 #endif
 
     acceptor_.async_accept(socket, [this, handler] (auto code) {
--- a/libcommon/irccd/socket_connector.hpp	Tue Apr 10 21:20:30 2018 +0200
+++ b/libcommon/irccd/socket_connector.hpp	Tue Apr 10 21:23:01 2018 +0200
@@ -129,6 +129,7 @@
 {
 #if !defined(NDEBUG)
     assert(!is_connecting_);
+
     is_connecting_ = true;
 #endif
 
--- a/libcommon/irccd/socket_stream.hpp	Tue Apr 10 21:20:30 2018 +0200
+++ b/libcommon/irccd/socket_stream.hpp	Tue Apr 10 21:23:01 2018 +0200
@@ -77,8 +77,8 @@
     std::string output_;
 
 #if !defined(NDEBUG)
-    bool is_receiving{false};
-    bool is_sending{false};
+    bool is_receiving_{false};
+    bool is_sending_{false};
 #endif
 
     void handle_read(boost::system::error_code, std::size_t, read_handler);
@@ -133,7 +133,7 @@
                                         read_handler handler)
 {
 #if !defined(NDEBUG)
-    is_receiving = false;
+    is_receiving_ = false;
 #endif
 
     if (xfer == 0U) {
@@ -182,7 +182,7 @@
                                          write_handler handler)
 {
 #if !defined(NDEBUG)
-    is_sending = false;
+    is_sending_ = false;
 #endif
 
     if (xfer == 0)
@@ -195,10 +195,10 @@
 void socket_stream<Socket>::read(read_handler handler)
 {
 #if !defined(NDEBUG)
-    assert(!is_receiving);
+    assert(!is_receiving_);
     assert(handler);
 
-    is_receiving = true;
+    is_receiving_ = true;
 #endif
 
     boost::asio::async_read_until(get_socket(), input_, "\r\n\r\n", [this, handler] (auto code, auto xfer) {
@@ -210,10 +210,10 @@
 void socket_stream<Socket>::write(const nlohmann::json& json, write_handler handler)
 {
 #if !defined(NDEBUG)
-    assert(!is_sending);
+    assert(!is_sending_);
     assert(handler);
 
-    is_sending = true;
+    is_sending_ = true;
 #endif
 
     output_ = json.dump(0) + "\r\n\r\n";
--- a/libirccd/irccd/daemon/transport_client.hpp	Tue Apr 10 21:20:30 2018 +0200
+++ b/libirccd/irccd/daemon/transport_client.hpp	Tue Apr 10 21:23:01 2018 +0200
@@ -70,11 +70,6 @@
     }
 
     /**
-     * Virtual destructor defaulted.
-     */
-    virtual ~transport_client() = default;
-
-    /**
      * Get the transport server parent.
      *
      * \return the parent
--- a/libirccd/irccd/daemon/transport_server.hpp	Tue Apr 10 21:20:30 2018 +0200
+++ b/libirccd/irccd/daemon/transport_server.hpp	Tue Apr 10 21:23:01 2018 +0200
@@ -19,6 +19,11 @@
 #ifndef IRCCD_DAEMON_TRANSPORT_SERVER_HPP
 #define IRCCD_DAEMON_TRANSPORT_SERVER_HPP
 
+/**
+ * \file transport_server.hpp
+ * \brief Server side transports.
+ */
+
 #include <irccd/sysconfig.hpp>
 
 #include <cassert>
@@ -156,22 +161,6 @@
     }
 
     /**
-     * Virtual destructor defaulted.
-     */
-    virtual ~transport_server() noexcept = default;
-
-    /**
-     * Accept a client.
-     *
-     * Also perform greetings and authentication under the hood. On success, the
-     * client is added into the server and is ready to use.
-     *
-     * \pre handler != nullptr
-     * \param handler the completion handler
-     */
-    void accept(accept_handler handler);
-
-    /**
      * Get the clients.
      *
      * \return the clients
@@ -210,6 +199,17 @@
     {
         password_ = std::move(password);
     }
+
+    /**
+     * Accept a client.
+     *
+     * Also perform greetings and authentication under the hood. On success, the
+     * client is added into the server and is ready to use.
+     *
+     * \pre handler != nullptr
+     * \param handler the completion handler
+     */
+    void accept(accept_handler handler);
 };
 
 /**
--- a/libirccdctl/irccd/ctl/controller.hpp	Tue Apr 10 21:20:30 2018 +0200
+++ b/libirccdctl/irccd/ctl/controller.hpp	Tue Apr 10 21:23:01 2018 +0200
@@ -78,29 +78,6 @@
         assert(connector_);
     }
 
-#if 0
-
-    /**
-     * Access the underlying connection.
-     *
-     * \return the connection
-     */
-    inline const connection& get_stream() const noexcept
-    {
-        return *stream_;
-    }
-
-    /**
-     * Overloaded function.
-     *
-     * \return the connection
-     */
-    inline connection& get_stream() noexcept
-    {
-        return *stream_;
-    }
-#endif
-
     /**
      * Get the optional password set.
      *