From fff238ec94ac6d45fc18c315d7bc590ddfaad63d Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 19 Mar 2016 21:48:36 +0000 Subject: Print stack trace upon exceptions Useful for debugging users' logs --- contrib/epee/include/misc_log_ex.h | 2 +- contrib/epee/include/net/abstract_tcp_server2.inl | 2 +- contrib/epee/include/storages/portable_storage_from_bin.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'contrib/epee/include') diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h index d1451ff12..58d47c472 100644 --- a/contrib/epee/include/misc_log_ex.h +++ b/contrib/epee/include/misc_log_ex.h @@ -1426,7 +1426,7 @@ POP_WARNINGS #define CATCH_ENTRY_L4(lacation, return_val) CATCH_ENTRY(lacation, return_val) -#define ASSERT_MES_AND_THROW(message) {LOG_ERROR(message); std::stringstream ss; ss << message; throw std::runtime_error(ss.str());} +#define ASSERT_MES_AND_THROW(message) {LOG_ERROR(message); std::stringstream ss; ss << message; throw tools::runtime_error(ss.str());} #define CHECK_AND_ASSERT_THROW_MES(expr, message) {if(!(expr)) ASSERT_MES_AND_THROW(message);} diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 698e1947a..e4a461203 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -777,7 +777,7 @@ POP_WARNINGS { m_thread_name_prefix = prefix_name; auto it = server_type_map.find(m_thread_name_prefix); - if (it==server_type_map.end()) throw std::runtime_error("Unknown prefix/server type:" + std::string(prefix_name)); + if (it==server_type_map.end()) throw tools::runtime_error("Unknown prefix/server type:" + std::string(prefix_name)); auto connection_type = it->second; // the value of type _info_c("net/RPClog", "Set server type to: " << connection_type << " from name: " << m_thread_name_prefix); _info_c("net/RPClog", "prefix_name = " << prefix_name); diff --git a/contrib/epee/include/storages/portable_storage_from_bin.h b/contrib/epee/include/storages/portable_storage_from_bin.h index bc2fb1463..4cb2003e0 100644 --- a/contrib/epee/include/storages/portable_storage_from_bin.h +++ b/contrib/epee/include/storages/portable_storage_from_bin.h @@ -84,9 +84,9 @@ namespace epee inline throwable_buffer_reader::throwable_buffer_reader(const void* ptr, size_t sz) { if(!ptr) - throw std::runtime_error("throwable_buffer_reader: ptr==nullptr"); + throw tools::runtime_error("throwable_buffer_reader: ptr==nullptr"); if(!sz) - throw std::runtime_error("throwable_buffer_reader: sz==0"); + throw tools::runtime_error("throwable_buffer_reader: sz==0"); m_ptr = (uint8_t*)ptr; m_count = sz; m_recursion_count = 0; -- cgit v1.2.3 From 2b4cab30fc47539a87b4644c7cf4c657da391c0c Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 20 Mar 2016 12:05:55 +0000 Subject: epee: fix potential hang on exit Also close sockets on failure, just in case --- contrib/epee/include/net/abstract_tcp_server2.inl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'contrib/epee/include') diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 698e1947a..1c854dfb7 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -1005,6 +1005,12 @@ POP_WARNINGS while(local_shared_context->ec == boost::asio::error::would_block) { bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout)); + if (m_stop_signal_sent) + { + if (sock_.is_open()) + sock_.close(); + return false; + } if(local_shared_context->ec == boost::asio::error::would_block && !r) { //timeout @@ -1018,6 +1024,8 @@ POP_WARNINGS if (ec || !sock_.is_open()) { _dbg3("Some problems at connect, message: " << ec.message()); + if (sock_.is_open()) + sock_.close(); return false; } -- cgit v1.2.3 From f7301c3563e7ae19b8d7c65d8bc88f3c42eefc09 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 21 Mar 2016 10:12:12 +0000 Subject: Revert "Print stack trace upon exceptions" Ain't nobody got time for link/cmake skullduggery. This reverts commit fff238ec94ac6d45fc18c315d7bc590ddfaad63d. --- contrib/epee/include/misc_log_ex.h | 2 +- contrib/epee/include/net/abstract_tcp_server2.inl | 2 +- contrib/epee/include/storages/portable_storage_from_bin.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'contrib/epee/include') diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h index 58d47c472..d1451ff12 100644 --- a/contrib/epee/include/misc_log_ex.h +++ b/contrib/epee/include/misc_log_ex.h @@ -1426,7 +1426,7 @@ POP_WARNINGS #define CATCH_ENTRY_L4(lacation, return_val) CATCH_ENTRY(lacation, return_val) -#define ASSERT_MES_AND_THROW(message) {LOG_ERROR(message); std::stringstream ss; ss << message; throw tools::runtime_error(ss.str());} +#define ASSERT_MES_AND_THROW(message) {LOG_ERROR(message); std::stringstream ss; ss << message; throw std::runtime_error(ss.str());} #define CHECK_AND_ASSERT_THROW_MES(expr, message) {if(!(expr)) ASSERT_MES_AND_THROW(message);} diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 2f6e52a5b..1c854dfb7 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -777,7 +777,7 @@ POP_WARNINGS { m_thread_name_prefix = prefix_name; auto it = server_type_map.find(m_thread_name_prefix); - if (it==server_type_map.end()) throw tools::runtime_error("Unknown prefix/server type:" + std::string(prefix_name)); + if (it==server_type_map.end()) throw std::runtime_error("Unknown prefix/server type:" + std::string(prefix_name)); auto connection_type = it->second; // the value of type _info_c("net/RPClog", "Set server type to: " << connection_type << " from name: " << m_thread_name_prefix); _info_c("net/RPClog", "prefix_name = " << prefix_name); diff --git a/contrib/epee/include/storages/portable_storage_from_bin.h b/contrib/epee/include/storages/portable_storage_from_bin.h index 4cb2003e0..bc2fb1463 100644 --- a/contrib/epee/include/storages/portable_storage_from_bin.h +++ b/contrib/epee/include/storages/portable_storage_from_bin.h @@ -84,9 +84,9 @@ namespace epee inline throwable_buffer_reader::throwable_buffer_reader(const void* ptr, size_t sz) { if(!ptr) - throw tools::runtime_error("throwable_buffer_reader: ptr==nullptr"); + throw std::runtime_error("throwable_buffer_reader: ptr==nullptr"); if(!sz) - throw tools::runtime_error("throwable_buffer_reader: sz==0"); + throw std::runtime_error("throwable_buffer_reader: sz==0"); m_ptr = (uint8_t*)ptr; m_count = sz; m_recursion_count = 0; -- cgit v1.2.3 From 51a56e78ae82c1c01f7bbf89600f7dd1c064042d Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Fri, 25 Mar 2016 14:33:58 +0200 Subject: remove unecessary and bad std::move from portable_storage_template_helper.h --- contrib/epee/include/storages/portable_storage_template_helper.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'contrib/epee/include') diff --git a/contrib/epee/include/storages/portable_storage_template_helper.h b/contrib/epee/include/storages/portable_storage_template_helper.h index 88515b5c3..bbd8413fc 100644 --- a/contrib/epee/include/storages/portable_storage_template_helper.h +++ b/contrib/epee/include/storages/portable_storage_template_helper.h @@ -72,7 +72,7 @@ namespace epee { std::string json_buff; store_t_to_json(str_in, json_buff, indent, insert_newlines); - return std::move(json_buff); + return json_buff; } //----------------------------------------------------------------------------------------------------------- template @@ -117,7 +117,7 @@ namespace epee { std::string binary_buff; store_t_to_binary(str_in, binary_buff, indent); - return std::move(binary_buff); + return binary_buff; } } } -- cgit v1.2.3