Browse Source

style update

cl-refactor
Vlad Gluhovsky 10 years ago
parent
commit
2314668581
  1. 9
      libp2p/NodeTable.cpp
  2. 2
      libp2p/NodeTable.h

9
libp2p/NodeTable.cpp

@ -201,12 +201,13 @@ void NodeTable::doDiscover(NodeId _node, unsigned _round, shared_ptr<set<shared_
if (_ec)
clog(NodeTableWarn) << "Discovery timer canceled: " << _ec.value() << _ec.message();
if (995 == _ec.value() || m_timers.isStopped())
if (_ec.value() == boost::asio::error::operation_aborted || m_timers.isStopped())
return;
// Error code 995 means that the timer was probably aborted. It usually happens when "this" object
// is deallocated, in which case subsequent call to doDiscover() would cause a crash.
// We can not rely on m_timers.isStopped(), because "this" pointer was captured by the lambda,
// error::operation_aborted means that the timer was probably aborted.
// It usually happens when "this" object is deallocated, in which case
// subsequent call to doDiscover() would cause a crash. We can not rely on
// m_timers.isStopped(), because "this" pointer was captured by the lambda,
// and therefore, in case of deallocation m_timers object no longer exists.
doDiscover(_node, _round + 1, _tried);

2
libp2p/NodeTable.h

@ -264,7 +264,7 @@ private:
std::shared_ptr<NodeSocket> m_socket; ///< Shared pointer for our UDPSocket; ASIO requires shared_ptr.
NodeSocket* m_socketPointer; ///< Set to m_socket.get(). Socket is created in constructor and disconnected in destructor to ensure access to pointer is safe.
DeadlineOps m_timers;
DeadlineOps m_timers; ///< this should be the last member - it must be destroyed first
};
inline std::ostream& operator<<(std::ostream& _out, NodeTable const& _nodeTable)

Loading…
Cancel
Save