diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/misc_log_ex.h | 1 | ||||
-rw-r--r-- | contrib/epee/include/misc_os_dependent.h | 12 | ||||
-rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 21 |
3 files changed, 25 insertions, 9 deletions
diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h index d1451ff12..7cb1e61aa 100644 --- a/contrib/epee/include/misc_log_ex.h +++ b/contrib/epee/include/misc_log_ex.h @@ -424,6 +424,7 @@ namespace log_space } std::cout << buf; + std::cout << std::flush; #endif reset_console_color(); return true; diff --git a/contrib/epee/include/misc_os_dependent.h b/contrib/epee/include/misc_os_dependent.h index 2abca0446..806d3e83e 100644 --- a/contrib/epee/include/misc_os_dependent.h +++ b/contrib/epee/include/misc_os_dependent.h @@ -53,11 +53,13 @@ namespace misc_utils #if defined(_MSC_VER) return ::GetTickCount64(); #elif defined(WIN32) -# if defined(WIN64) - return GetTickCount64(); -# else - return GetTickCount(); -# endif + static LARGE_INTEGER pcfreq = {0}; + LARGE_INTEGER ticks; + if (!pcfreq.QuadPart) + QueryPerformanceFrequency(&pcfreq); + QueryPerformanceCounter(&ticks); + ticks.QuadPart *= 1000; /* we want msec */ + return ticks.QuadPart / pcfreq.QuadPart; #elif defined(__MACH__) clock_serv_t cclock; mach_timespec_t mts; diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 1c854dfb7..b3d4e5fdb 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -252,11 +252,24 @@ PRAGMA_WARNING_DISABLE_VS(4355) template<class t_protocol_handler> void connection<t_protocol_handler>::save_dbg_log() { + std::string address, port; + boost::system::error_code e; + + boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(e); + if (e) + { + address = "<not connected>"; + port = "<not connected>"; + } + else + { + address = endpoint.address().to_string(); + port = boost::lexical_cast<std::string>(endpoint.port()); + } _mark_c("net/kind" , - " connection type " << to_string( m_connection_type ) << " " - << socket_.local_endpoint().address().to_string() << ":" << socket_.local_endpoint().port() - << " <--> " << socket_.remote_endpoint().address().to_string() << ":" << socket_.remote_endpoint().port() - ); + " connection type " << to_string( m_connection_type ) << " " + << socket_.local_endpoint().address().to_string() << ":" << socket_.local_endpoint().port() + << " <--> " << address << ":" << port); } //--------------------------------------------------------------------------------- template<class t_protocol_handler> |