Merge master (0.60.3) into develop (0.70.0-b5)

This commit is contained in:
Nik Bougalis
2017-05-16 15:12:55 -07:00
7 changed files with 93 additions and 9 deletions

View File

@@ -210,6 +210,12 @@ PeerImp::send (Message::pointer const& m)
// a small senq periodically
large_sendq_ = 0;
}
else if ((sendq_size % Tuning::sendQueueLogFreq) == 0)
{
JLOG (journal_.debug()) <<
(name_.empty() ? remote_address_.to_string() : name_) <<
" sendq: " << sendq_size;
}
send_queue_.push(m);
@@ -442,7 +448,9 @@ PeerImp::fail(std::string const& reason)
shared_from_this(), reason));
if (socket_.is_open())
{
JLOG (journal_.warn()) << reason;
JLOG (journal_.warn()) <<
(name_.empty() ? remote_address_.to_string() : name_) <<
" failed: " << reason;
}
close();
}

View File

@@ -52,13 +52,13 @@ enum
/** How many milliseconds to consider high latency
on a peer connection */
peerHighLatency = 250,
peerHighLatency = 300,
/** How often we check connections (seconds) */
checkSeconds = 10,
checkSeconds = 32,
/** How often we latency/sendq probe connections */
timerSeconds = 4,
timerSeconds = 8,
/** How many timer intervals a sendq has to stay large before we disconnect */
sendqIntervals = 4,
@@ -67,10 +67,13 @@ enum
noPing = 10,
/** How many messages on a send queue before we refuse queries */
dropSendQueue = 8,
dropSendQueue = 192,
/** How many messages we consider reasonable sustained on a send queue */
targetSendQueue = 16,
targetSendQueue = 128,
/** How often to log send queue size */
sendQueueLogFreq = 64,
};
} // Tuning

View File

@@ -129,6 +129,30 @@ Bootcache::insert (beast::IP::Endpoint const& endpoint)
return result.second;
}
bool
Bootcache::insertStatic (beast::IP::Endpoint const& endpoint)
{
auto result (m_map.insert (
value_type (endpoint, staticValence)));
if (! result.second && (result.first->right.valence() < staticValence))
{
// An existing entry has too low a valence, replace it
m_map.erase (result.first);
result = m_map.insert (
value_type (endpoint, staticValence));
}
if (result.second)
{
JLOG(m_journal.trace()) << beast::leftw (18) <<
"Bootcache insert " << endpoint;
prune ();
flagForUpdate();
}
return result.second;
}
void
Bootcache::on_success (beast::IP::Endpoint const& endpoint)
{
@@ -197,7 +221,13 @@ Bootcache::periodicActivity ()
void
Bootcache::onWrite (beast::PropertyStream::Map& map)
{
map ["entries"] = std::uint32_t (m_map.size());
beast::PropertyStream::Set entries ("entries", map);
for (auto iter = m_map.right.begin(); iter != m_map.right.end(); ++iter)
{
beast::PropertyStream::Map entry (entries);
entry["endpoint"] = iter->get_left().to_string();
entry["valence"] = std::int32_t (iter->get_right().valence());
}
}
// Checks the cache size and prunes if its over the limit.

View File

@@ -110,6 +110,8 @@ private:
bool m_needsUpdate;
public:
static constexpr int staticValence = 32;
using iterator = boost::transform_iterator <Transform,
map_type::right_map::const_iterator>;
@@ -140,9 +142,12 @@ public:
/** Load the persisted data from the Store into the container. */
void load ();
/** Add the address to the cache. */
/** Add a newly-learned address to the cache. */
bool insert (beast::IP::Endpoint const& endpoint);
/** Add a staticallyconfigured address to the cache. */
bool insertStatic (beast::IP::Endpoint const& endpoint);
/** Called when an outbound connection handshake completes. */
void on_success (beast::IP::Endpoint const& endpoint);

View File

@@ -990,7 +990,7 @@ public:
std::lock_guard<std::recursive_mutex> _(lock_);
for (auto addr : list)
{
if (bootcache_.insert (addr))
if (bootcache_.insertStatic (addr))
++count;
}
return count;