From ce92f4dc7235f8c402c293e54a2920dd3b753f9e Mon Sep 17 00:00:00 2001 From: subtly Date: Sat, 6 Dec 2014 02:18:14 +0100 Subject: [PATCH] cleanup --- libp2p/Host.cpp | 13 ++++++------- libp2p/Host.h | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index 04c9c8a85..15521cb28 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -355,13 +355,12 @@ void Host::runAcceptor() } } - if (!success) - if (m_socket->is_open()) - { - boost::system::error_code ec; - m_socket->shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); - m_socket->close(); - } + if (!success && m_socket->is_open()) + { + boost::system::error_code ec; + m_socket->shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); + m_socket->close(); + } m_accepting = false; if (ec.value() < 1) diff --git a/libp2p/Host.h b/libp2p/Host.h index bc0e83174..a146d6a66 100644 --- a/libp2p/Host.h +++ b/libp2p/Host.h @@ -194,13 +194,13 @@ private: /// Called by Worker. Not thread-safe; to be called only by worker. virtual void startedWorking(); - /// Called by startedWorking. Not thread-safe; to be called only be worker callback. + /// Called by startedWorking. Not thread-safe; to be called only be Worker. void run(boost::system::error_code const& error); ///< Run network. Called serially via ASIO deadline timer. Manages connection state transitions. - /// Run network. Called by Worker. Not thread-safe; to be called only by worker. + /// Run network. Not thread-safe; to be called only by worker. virtual void doWork(); - /// Shutdown network. Called by Worker. Not thread-safe; to be called only by worker. + /// Shutdown network. Not thread-safe; to be called only by worker. virtual void doneWorking(); std::shared_ptr noteNode(NodeId _id, bi::tcp::endpoint _a, Origin _o, bool _ready, NodeId _oldId = NodeId());