mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
network_throttle: fix ineffective locking
This commit is contained in:
parent
e0a61299fb
commit
bd5cce07b3
1 changed files with 5 additions and 3 deletions
|
@ -231,8 +231,10 @@ network_time_seconds network_throttle::get_sleep_time_after_tick(size_t packet_s
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_throttle::logger_handle_net(const std::string &filename, double time, size_t size) {
|
void network_throttle::logger_handle_net(const std::string &filename, double time, size_t size) {
|
||||||
boost::mutex mutex;
|
static boost::mutex mutex;
|
||||||
mutex.lock(); {
|
|
||||||
|
boost::lock_guard<boost::mutex> lock(mutex);
|
||||||
|
{
|
||||||
std::fstream file;
|
std::fstream file;
|
||||||
file.open(filename.c_str(), std::ios::app | std::ios::out );
|
file.open(filename.c_str(), std::ios::app | std::ios::out );
|
||||||
file.precision(6);
|
file.precision(6);
|
||||||
|
@ -240,7 +242,7 @@ void network_throttle::logger_handle_net(const std::string &filename, double tim
|
||||||
_warn("Can't open file " << filename);
|
_warn("Can't open file " << filename);
|
||||||
file << static_cast<int>(time) << " " << static_cast<double>(size/1024) << "\n";
|
file << static_cast<int>(time) << " " << static_cast<double>(size/1024) << "\n";
|
||||||
file.close();
|
file.close();
|
||||||
} mutex.unlock();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fine tune this to decide about sending speed:
|
// fine tune this to decide about sending speed:
|
||||||
|
|
Loading…
Reference in a new issue