Fix pollitems_stale not being set in some cases

This could cause stalls of up to 250ms before we detect an incoming
message.
This commit is contained in:
Jason Rhinelander 2020-04-06 13:16:55 -03:00
parent af42875e97
commit 95540ec7d5
1 changed files with 2 additions and 0 deletions

View File

@ -124,6 +124,7 @@ LokiMQ::proxy_connect_sn(string_view remote, string_view connect_hint, bool opti
conn_index_to_id.push_back(remote_cid);
peers.emplace(std::move(remote_cid), std::move(p));
connections.push_back(std::move(socket));
pollitems_stale = true;
return {&connections.back(), ""s};
}
@ -298,6 +299,7 @@ void LokiMQ::proxy_connect_remote(bt_dict_consumer data) {
}
connections.push_back(std::move(sock));
pollitems_stale = true;
LMQ_LOG(debug, "Opened new zmq socket to ", remote, ", conn_id ", conn_id, "; sending HI");
send_direct_message(connections.back(), "HI");
pending_connects.emplace_back(connections.size()-1, conn_id, std::chrono::steady_clock::now() + timeout,