diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 05daada69..f3714e76e 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -211,11 +211,11 @@ Main::Main(QWidget *parent) : Main::~Main() { + writeSettings(); // Must do this here since otherwise m_ethereum'll be deleted (and therefore clearWatches() called by the destructor) // *after* the client is dead. m_qweb->clientDieing(); g_logPost = simpleDebugOut; - writeSettings(); } void Main::on_newIdentity_triggered() diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index e9c172ac1..7010f9b04 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -428,8 +428,9 @@ void Host::addNode(NodeId const& _node, std::string const& _addr, unsigned short void Host::connect(std::shared_ptr const& _p) { - while (isWorking() && !m_run) - this_thread::sleep_for(chrono::milliseconds(50)); + for (unsigned i = 0; i < 40; i++) + if (isWorking() && !m_run) + this_thread::sleep_for(chrono::milliseconds(50)); if (!m_run) return; @@ -442,6 +443,7 @@ void Host::connect(std::shared_ptr const& _p) if (!m_nodeTable->haveNode(_p->id)) { clog(NetWarn) << "Aborted connect. Node not in node table."; + m_nodeTable->addNode(*_p.get()); return; } diff --git a/libp2p/NodeTable.cpp b/libp2p/NodeTable.cpp index 3ccbca62d..e6f8a171b 100644 --- a/libp2p/NodeTable.cpp +++ b/libp2p/NodeTable.cpp @@ -65,7 +65,7 @@ void NodeTable::processEvents() shared_ptr NodeTable::addNode(Public const& _pubk, bi::udp::endpoint const& _udp, bi::tcp::endpoint const& _tcp) { auto node = Node(_pubk, NodeIPEndpoint(_udp, _tcp)); - return move(addNode(node)); + return addNode(node); } shared_ptr NodeTable::addNode(Node const& _node) @@ -101,7 +101,7 @@ shared_ptr NodeTable::addNode(Node const& _node) if (m_nodeEventHandler) m_nodeEventHandler->appendEvent(_node.id, NodeEntryAdded); - return move(ret); + return ret; } void NodeTable::discover()