aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-06-24 12:41:09 +0200
committerRiccardo Spagni <ric@spagni.net>2017-06-24 12:41:09 +0200
commitf31b89012d5299e08ea897bf1061a5b3def8d96a (patch)
tree2638c936e5f95127dd5db618355da28fd0f140ee /src/p2p
parentMerge pull request #2069 (diff)
parentDon't issue a new timedsync while one is already in progress (diff)
downloadmonero-f31b89012d5299e08ea897bf1061a5b3def8d96a.tar.xz
Merge pull request #2073
07c4276c Don't issue a new timedsync while one is already in progress (Howard Chu) cf3a376c Don't timeout a slow operation that's making progress (Howard Chu) 340830de Fix PR#2039 (Howard Chu)
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/net_node.inl8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 47582cb96..c250d5185 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -812,6 +812,7 @@ namespace nodetool
bool r = epee::net_utils::async_invoke_remote_command2<typename COMMAND_TIMED_SYNC::response>(context_.m_connection_id, COMMAND_TIMED_SYNC::ID, arg, m_net_server.get_config_object(),
[this](int code, const typename COMMAND_TIMED_SYNC::response& rsp, p2p_connection_context& context)
{
+ context.m_in_timedsync = false;
if(code < 0)
{
LOG_ERROR_CC(context, "COMMAND_TIMED_SYNC invoke failed. (" << code << ", " << epee::levin::get_err_descr(code) << ")");
@@ -1295,10 +1296,13 @@ namespace nodetool
MDEBUG("STARTED PEERLIST IDLE HANDSHAKE");
typedef std::list<std::pair<epee::net_utils::connection_context_base, peerid_type> > local_connects_type;
local_connects_type cncts;
- m_net_server.get_config_object().foreach_connection([&](const p2p_connection_context& cntxt)
+ m_net_server.get_config_object().foreach_connection([&](p2p_connection_context& cntxt)
{
- if(cntxt.peer_id)
+ if(cntxt.peer_id && !cntxt.m_in_timedsync)
+ {
+ cntxt.m_in_timedsync = true;
cncts.push_back(local_connects_type::value_type(cntxt, cntxt.peer_id));//do idle sync only with handshaked connections
+ }
return true;
});