aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/src
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/epee/src')
-rw-r--r--contrib/epee/src/mlog.cpp1
-rw-r--r--contrib/epee/src/network_throttle-detail.cpp8
-rw-r--r--contrib/epee/src/network_throttle.cpp3
3 files changed, 6 insertions, 6 deletions
diff --git a/contrib/epee/src/mlog.cpp b/contrib/epee/src/mlog.cpp
index a30efbc6a..5b9472006 100644
--- a/contrib/epee/src/mlog.cpp
+++ b/contrib/epee/src/mlog.cpp
@@ -59,6 +59,7 @@ static std::string generate_log_filename(const char *base)
strcpy(tmp, "unknown");
else
strftime(tmp, sizeof(tmp), "%Y-%m-%d-%H-%M-%S", &tm);
+ tmp[sizeof(tmp) - 1] = 0;
filename += "-";
filename += tmp;
return filename;
diff --git a/contrib/epee/src/network_throttle-detail.cpp b/contrib/epee/src/network_throttle-detail.cpp
index 317dde8e0..ed6bc07ed 100644
--- a/contrib/epee/src/network_throttle-detail.cpp
+++ b/contrib/epee/src/network_throttle-detail.cpp
@@ -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) {
- boost::mutex mutex;
- mutex.lock(); {
+ static boost::mutex mutex;
+
+ boost::lock_guard<boost::mutex> lock(mutex);
+ {
std::fstream file;
file.open(filename.c_str(), std::ios::app | std::ios::out );
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);
file << static_cast<int>(time) << " " << static_cast<double>(size/1024) << "\n";
file.close();
- } mutex.unlock();
+ }
}
// fine tune this to decide about sending speed:
diff --git a/contrib/epee/src/network_throttle.cpp b/contrib/epee/src/network_throttle.cpp
index afacc3e96..dd1640a2e 100644
--- a/contrib/epee/src/network_throttle.cpp
+++ b/contrib/epee/src/network_throttle.cpp
@@ -71,9 +71,6 @@ boost::mutex network_throttle_manager::m_lock_get_global_throttle_in;
boost::mutex network_throttle_manager::m_lock_get_global_throttle_inreq;
boost::mutex network_throttle_manager::m_lock_get_global_throttle_out;
-int network_throttle_manager::xxx;
-
-
// ================================================================================================
// methods:
i_network_throttle & network_throttle_manager::get_global_throttle_in() {