Merge pull request #5893

Coverity fixes [3a81639, 1bd962d, 2825f07, d099658, d46f701, cd57a10] (anonimal)
This commit is contained in:
luigi1111 2019-09-30 18:43:48 -05:00
commit c6430f9dd0
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
6 changed files with 24 additions and 4 deletions

View file

@ -50,6 +50,8 @@
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <random>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
@ -628,7 +630,17 @@ PRAGMA_WARNING_DISABLE_VS(4355)
return false; // aborted
}*/
long int ms = 250 + (rand()%50);
using engine = std::mt19937;
engine rng;
std::random_device dev;
std::seed_seq::result_type rand[engine::state_size]{}; // Use complete bit space
std::generate_n(rand, engine::state_size, std::ref(dev));
std::seed_seq seed(rand, rand + engine::state_size);
rng.seed(seed);
long int ms = 250 + (rng() % 50);
MDEBUG("Sleeping because QUEUE is FULL, in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<chunk.size()); // XXX debug sleep
m_send_que_lock.unlock();
boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) );