Browse Source

cleanup

cl-refactor
subtly 10 years ago
parent
commit
ce92f4dc72
  1. 13
      libp2p/Host.cpp
  2. 6
      libp2p/Host.h

13
libp2p/Host.cpp

@ -355,13 +355,12 @@ void Host::runAcceptor()
} }
} }
if (!success) if (!success && m_socket->is_open())
if (m_socket->is_open()) {
{ boost::system::error_code ec;
boost::system::error_code ec; m_socket->shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
m_socket->shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); m_socket->close();
m_socket->close(); }
}
m_accepting = false; m_accepting = false;
if (ec.value() < 1) if (ec.value() < 1)

6
libp2p/Host.h

@ -194,13 +194,13 @@ private:
/// Called by Worker. Not thread-safe; to be called only by worker. /// Called by Worker. Not thread-safe; to be called only by worker.
virtual void startedWorking(); 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. 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(); 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(); virtual void doneWorking();
std::shared_ptr<Node> noteNode(NodeId _id, bi::tcp::endpoint _a, Origin _o, bool _ready, NodeId _oldId = NodeId()); std::shared_ptr<Node> noteNode(NodeId _id, bi::tcp::endpoint _a, Origin _o, bool _ready, NodeId _oldId = NodeId());

Loading…
Cancel
Save