aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt18
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl2
-rw-r--r--contrib/epee/include/net/net_utils_base.h2
-rw-r--r--contrib/epee/include/storages/portable_storage_from_bin.h2
-rw-r--r--external/db_drivers/liblmdb/midl.h4
-rw-r--r--src/blockchain_utilities/cn_deserialize.cpp3
-rw-r--r--src/common/CMakeLists.txt7
-rw-r--r--src/common/stack_trace.cpp120
-rw-r--r--src/common/stack_trace.h43
-rw-r--r--src/crypto/crypto.cpp9
-rw-r--r--src/crypto/oaes_lib.c4
-rw-r--r--src/crypto/slow-hash.c6
-rw-r--r--src/cryptonote_core/tx_extra.h13
-rw-r--r--src/daemon/main.cpp2
-rw-r--r--src/p2p/connection_basic.cpp6
-rw-r--r--src/p2p/connection_basic.hpp2
-rw-r--r--src/p2p/data_logger.cpp2
-rw-r--r--src/p2p/data_logger.hpp2
-rw-r--r--tests/unit_tests/hardfork.cpp4
19 files changed, 220 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9674404bb..09ca449d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -243,6 +243,14 @@ endif()
add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}")
+find_package(Libunwind)
+if(LIBUNWIND_FOUND)
+ message(STATUS "Using libunwind to provide stack traces")
+ add_definitions("-DHAVE_LIBUNWIND")
+else()
+ message(STATUS "Stack traces disabled")
+endif()
+
if (UNIX AND NOT APPLE)
# Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail
set(THREADS_PREFER_PTHREAD_FLAG ON)
@@ -274,6 +282,10 @@ if (BERKELEY_DB)
include_directories(${BDB_INCLUDE})
endif()
+# Final setup for libunwind
+include_directories(${LIBUNWIND_INCLUDE})
+link_directories(${LIBUNWIND_LIBRARY_DIRS})
+
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
@@ -394,6 +406,7 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
if(STATIC AND NOT APPLE AND NOT FREEBSD AND NOT OPENBSD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--wrap=__cxa_throw")
endif()
endif()
@@ -431,6 +444,11 @@ elseif(NOT MSVC)
set(EXTRA_LIBRARIES ${RT})
endif()
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ find_library(DL dl)
+ set(EXTRA_LIBRARIES ${DL})
+endif()
+
include(version.cmake)
add_subdirectory(contrib)
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index ca9429c91..94dbe7458 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -88,7 +88,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
PRAGMA_WARNING_DISABLE_VS(4355)
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
- connection<t_protocol_handler>::~connection()
+ connection<t_protocol_handler>::~connection() noexcept(false)
{
if(!m_was_shutdown)
{
diff --git a/contrib/epee/include/net/net_utils_base.h b/contrib/epee/include/net/net_utils_base.h
index f963e7746..78e555fac 100644
--- a/contrib/epee/include/net/net_utils_base.h
+++ b/contrib/epee/include/net/net_utils_base.h
@@ -119,7 +119,7 @@ namespace net_utils
virtual bool add_ref()=0;
virtual bool release()=0;
protected:
- virtual ~i_service_endpoint(){}
+ virtual ~i_service_endpoint() noexcept(false) {}
};
diff --git a/contrib/epee/include/storages/portable_storage_from_bin.h b/contrib/epee/include/storages/portable_storage_from_bin.h
index bc2fb1463..44a80cb21 100644
--- a/contrib/epee/include/storages/portable_storage_from_bin.h
+++ b/contrib/epee/include/storages/portable_storage_from_bin.h
@@ -68,7 +68,7 @@ namespace epee
++m_counter_ref;
CHECK_AND_ASSERT_THROW_MES(m_counter_ref < EPEE_PORTABLE_STORAGE_RECURSION_LIMIT_INTERNAL, "Wrong blob data in portable storage: recursion limitation (" << EPEE_PORTABLE_STORAGE_RECURSION_LIMIT_INTERNAL << ") exceeded");
}
- ~recursuion_limitation_guard()
+ ~recursuion_limitation_guard() noexcept(false)
{
CHECK_AND_ASSERT_THROW_MES(m_counter_ref != 0, "Internal error: m_counter_ref == 0 while ~recursuion_limitation_guard()");
--m_counter_ref;
diff --git a/external/db_drivers/liblmdb/midl.h b/external/db_drivers/liblmdb/midl.h
index e16aa0c3c..1555ecb19 100644
--- a/external/db_drivers/liblmdb/midl.h
+++ b/external/db_drivers/liblmdb/midl.h
@@ -60,11 +60,7 @@ typedef MDB_ID *MDB_IDL;
/* IDL sizes - likely should be even bigger
* limiting factors: sizeof(ID), thread stack size
*/
-#ifdef MDB_VL32
-#define MDB_IDL_LOGN 14 /* DB_SIZE is 2^14, UM_SIZE is 2^15 */
-#else
#define MDB_IDL_LOGN 16 /* DB_SIZE is 2^16, UM_SIZE is 2^17 */
-#endif
#define MDB_IDL_DB_SIZE (1<<MDB_IDL_LOGN)
#define MDB_IDL_UM_SIZE (1<<(MDB_IDL_LOGN+1))
diff --git a/src/blockchain_utilities/cn_deserialize.cpp b/src/blockchain_utilities/cn_deserialize.cpp
index b8d38c9af..a8448dcee 100644
--- a/src/blockchain_utilities/cn_deserialize.cpp
+++ b/src/blockchain_utilities/cn_deserialize.cpp
@@ -160,8 +160,9 @@ int main(int argc, char* argv[])
std::cout << "field " << n << ": ";
if (typeid(cryptonote::tx_extra_padding) == fields[n].type()) std::cout << "extra padding: " << boost::get<cryptonote::tx_extra_padding>(fields[n]).size << " bytes";
else if (typeid(cryptonote::tx_extra_pub_key) == fields[n].type()) std::cout << "extra pub key: " << boost::get<cryptonote::tx_extra_pub_key>(fields[n]).pub_key;
- else if (typeid(cryptonote::tx_extra_nonce) == fields[n].type()) std::cout << "extra nonce: " << boost::get<cryptonote::tx_extra_nonce>(fields[n]).nonce;
+ else if (typeid(cryptonote::tx_extra_nonce) == fields[n].type()) std::cout << "extra nonce: " << epee::string_tools::buff_to_hex_nodelimer(boost::get<cryptonote::tx_extra_nonce>(fields[n]).nonce);
else if (typeid(cryptonote::tx_extra_merge_mining_tag) == fields[n].type()) std::cout << "extra merge mining tag: depth " << boost::get<cryptonote::tx_extra_merge_mining_tag>(fields[n]).depth << ", merkle root " << boost::get<cryptonote::tx_extra_merge_mining_tag>(fields[n]).merkle_root;
+ else if (typeid(cryptonote::tx_extra_mysterious_minergate) == fields[n].type()) std::cout << "extra minergate custom: " << epee::string_tools::buff_to_hex_nodelimer(boost::get<cryptonote::tx_extra_mysterious_minergate>(fields[n]).data);
else std::cout << "unknown";
std::cout << std::endl;
}
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 2289704e5..9afbe4b82 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -31,7 +31,8 @@ set(common_sources
command_line.cpp
dns_utils.cpp
util.cpp
- i18n.cpp)
+ i18n.cpp
+ stack_trace.cpp)
set(common_headers)
@@ -48,7 +49,8 @@ set(common_private_headers
unordered_containers_boost_serialization.h
util.h
varint.h
- i18n.h)
+ i18n.h
+ stack_trace.h)
bitmonero_private_headers(common
${common_private_headers})
@@ -60,6 +62,7 @@ target_link_libraries(common
LINK_PRIVATE
crypto
${UNBOUND_LIBRARY}
+ ${LIBUNWIND_LIBRARIES}
${Boost_DATE_TIME_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
diff --git a/src/common/stack_trace.cpp b/src/common/stack_trace.cpp
new file mode 100644
index 000000000..1a65ca656
--- /dev/null
+++ b/src/common/stack_trace.cpp
@@ -0,0 +1,120 @@
+// Copyright (c) 2016, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "common/stack_trace.h"
+#include "misc_log_ex.h"
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#include <cxxabi.h>
+#include <dlfcn.h>
+
+// from http://stackoverflow.com/questions/11665829/how-can-i-print-stack-trace-for-caught-exceptions-in-c-code-injection-in-c
+#ifdef STATICLIB
+#define CXA_THROW __wrap___cxa_throw
+extern "C" void __real___cxa_throw(void *ex, void *info, void (*dest)(void*));
+#else
+#define CXA_THROW __cxa_throw
+#endif
+
+extern "C" void CXA_THROW(void *ex, void *info, void (*dest)(void*))
+{
+
+ int status;
+ char *dsym = abi::__cxa_demangle(((const std::type_info*)info)->name(), NULL, NULL, &status);
+ tools::log_stack_trace((std::string("Exception: ")+((!status && dsym) ? dsym : (const char*)info)).c_str());
+ free(dsym);
+
+#ifdef STATICLIB
+ __real___cxa_throw(ex, info, dest);
+#else
+ static void (*const rethrow)(void*, void*, void(*)(void*)) __attribute__((noreturn)) = (void(*)(void*, void*, void(*)(void*)))dlsym(RTLD_NEXT, "__cxa_throw");
+ rethrow(ex, info, dest);
+#endif
+}
+
+namespace
+{
+ std::string stack_trace_log;
+}
+
+namespace tools
+{
+
+void set_stack_trace_log(const std::string &log)
+{
+ stack_trace_log = log;
+}
+
+void log_stack_trace(const char *msg)
+{
+#ifdef HAVE_LIBUNWIND
+ unw_context_t ctx;
+ unw_cursor_t cur;
+ unw_word_t ip, off;
+ unsigned level;
+ char sym[512], *dsym;
+ int status;
+ const char *log = stack_trace_log.empty() ? NULL : stack_trace_log.c_str();
+
+ if (msg)
+ LOG_PRINT2(log, msg, LOG_LEVEL_0);
+ LOG_PRINT2(log, "Unwinded call stack:", LOG_LEVEL_0);
+ if (unw_getcontext(&ctx) < 0) {
+ LOG_PRINT2(log, "Failed to create unwind context", LOG_LEVEL_0);
+ return;
+ }
+ if (unw_init_local(&cur, &ctx) < 0) {
+ LOG_PRINT2(log, "Failed to find the first unwind frame", LOG_LEVEL_0);
+ return;
+ }
+ for (level = 1; level < 999; ++level) { // 999 for safety
+ int ret = unw_step(&cur);
+ if (ret < 0) {
+ LOG_PRINT2(log, "Failed to find the next frame", LOG_LEVEL_0);
+ return;
+ }
+ if (ret == 0)
+ break;
+ if (unw_get_reg(&cur, UNW_REG_IP, &ip) < 0) {
+ LOG_PRINT2(log, " " << std::setw(4) << level, LOG_LEVEL_0);
+ continue;
+ }
+ if (unw_get_proc_name(&cur, sym, sizeof(sym), &off) < 0) {
+ LOG_PRINT2(log, " " << std::setw(4) << level << std::setbase(16) << std::setw(20) << "0x" << ip, LOG_LEVEL_0);
+ continue;
+ }
+ dsym = abi::__cxa_demangle(sym, NULL, NULL, &status);
+ LOG_PRINT2(log, " " << std::setw(4) << level << std::setbase(16) << std::setw(20) << "0x" << ip << " " << (!status && dsym ? dsym : sym) << " + " << "0x" << off, LOG_LEVEL_0);
+ free(dsym);
+ }
+#else
+#warning libunwind disabled, no stack traces
+#endif
+}
+
+} // namespace tools
diff --git a/src/common/stack_trace.h b/src/common/stack_trace.h
new file mode 100644
index 000000000..25eec9fb3
--- /dev/null
+++ b/src/common/stack_trace.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2016, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef MONERO_EXCEPTION_H
+#define MONERO_EXCEPTION_H
+
+#include <stdexcept>
+#include <string>
+
+namespace tools
+{
+
+void set_stack_trace_log(const std::string &log);
+void log_stack_trace(const char *msg);
+
+} // namespace tools
+
+#endif
diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp
index e251d0ec2..f5e655274 100644
--- a/src/crypto/crypto.cpp
+++ b/src/crypto/crypto.cpp
@@ -263,16 +263,17 @@ namespace crypto {
PUSH_WARNINGS
DISABLE_VS_WARNINGS(4200)
+ struct ec_point_pair {
+ ec_point a, b;
+ };
struct rs_comm {
hash h;
- struct {
- ec_point a, b;
- } ab[];
+ struct ec_point_pair ab[];
};
POP_WARNINGS
static inline size_t rs_comm_size(size_t pubs_count) {
- return sizeof(rs_comm) + pubs_count * sizeof(rs_comm().ab[0]);
+ return sizeof(rs_comm) + pubs_count * sizeof(ec_point_pair);
}
void crypto_ops::generate_ring_signature(const hash &prefix_hash, const key_image &image,
diff --git a/src/crypto/oaes_lib.c b/src/crypto/oaes_lib.c
index 7fbe96e4c..4c1446898 100644
--- a/src/crypto/oaes_lib.c
+++ b/src/crypto/oaes_lib.c
@@ -27,10 +27,6 @@
* POSSIBILITY OF SUCH DAMAGE.
* ---------------------------------------------------------------------------
*/
-static const char _NR[] = {
- 0x4e,0x61,0x62,0x69,0x6c,0x20,0x53,0x2e,0x20,
- 0x41,0x6c,0x20,0x52,0x61,0x6d,0x6c,0x69,0x00 };
-
#include <stddef.h>
#include <time.h>
#include <string.h>
diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c
index 6e03be4d4..8a1807657 100644
--- a/src/crypto/slow-hash.c
+++ b/src/crypto/slow-hash.c
@@ -658,10 +658,6 @@ void slow_hash_free_state(void)
return;
}
-static void (*const extra_hashes[4])(const void *, size_t, char *) = {
- hash_extra_blake, hash_extra_groestl, hash_extra_jh, hash_extra_skein
-};
-
#define MEMORY (1 << 21) /* 2 MiB */
#define ITER (1 << 20)
#define AES_BLOCK_SIZE 16
@@ -827,7 +823,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash)
{
for(j = 0; j < INIT_SIZE_BLK; j++)
aesb_pseudo_round(&text[AES_BLOCK_SIZE * j], &text[AES_BLOCK_SIZE * j], expandedKey);
- memcpy(&long_state[i * INIT_SIZE_BYTE], text, INIT_SIZE_BYTE);
+ memcpy(&long_state[i * INIT_SIZE_BYTE], text, INIT_SIZE_BYTE);
}
U64(a)[0] = U64(&state.k[0])[0] ^ U64(&state.k[32])[0];
diff --git a/src/cryptonote_core/tx_extra.h b/src/cryptonote_core/tx_extra.h
index 93d2e21b3..6f5fbe466 100644
--- a/src/cryptonote_core/tx_extra.h
+++ b/src/cryptonote_core/tx_extra.h
@@ -38,6 +38,7 @@
#define TX_EXTRA_TAG_PUBKEY 0x01
#define TX_EXTRA_NONCE 0x02
#define TX_EXTRA_MERGE_MINING_TAG 0x03
+#define TX_EXTRA_MYSTERIOUS_MINERGATE_TAG 0xDE
#define TX_EXTRA_NONCE_PAYMENT_ID 0x00
#define TX_EXTRA_NONCE_ENCRYPTED_PAYMENT_ID 0x01
@@ -158,14 +159,24 @@ namespace cryptonote
}
};
+ struct tx_extra_mysterious_minergate
+ {
+ std::string data;
+
+ BEGIN_SERIALIZE()
+ FIELD(data)
+ END_SERIALIZE()
+ };
+
// tx_extra_field format, except tx_extra_padding and tx_extra_pub_key:
// varint tag;
// varint size;
// varint data[];
- typedef boost::variant<tx_extra_padding, tx_extra_pub_key, tx_extra_nonce, tx_extra_merge_mining_tag> tx_extra_field;
+ typedef boost::variant<tx_extra_padding, tx_extra_pub_key, tx_extra_nonce, tx_extra_merge_mining_tag, tx_extra_mysterious_minergate> tx_extra_field;
}
VARIANT_TAG(binary_archive, cryptonote::tx_extra_padding, TX_EXTRA_TAG_PADDING);
VARIANT_TAG(binary_archive, cryptonote::tx_extra_pub_key, TX_EXTRA_TAG_PUBKEY);
VARIANT_TAG(binary_archive, cryptonote::tx_extra_nonce, TX_EXTRA_NONCE);
VARIANT_TAG(binary_archive, cryptonote::tx_extra_merge_mining_tag, TX_EXTRA_MERGE_MINING_TAG);
+VARIANT_TAG(binary_archive, cryptonote::tx_extra_mysterious_minergate, TX_EXTRA_MYSTERIOUS_MINERGATE_TAG);
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index bfd829dea..2e2f8936c 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -31,6 +31,7 @@
#include "common/command_line.h"
#include "common/scoped_message_writer.h"
#include "common/util.h"
+#include "common/stack_trace.h"
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/miner.h"
#include "daemon/command_server.h"
@@ -259,6 +260,7 @@ int main(int argc, char const * argv[])
, log_file_path.filename().string().c_str()
, log_file_path.parent_path().string().c_str()
);
+ tools::set_stack_trace_log(log_file_path.filename().string());
}
if (command_line::has_arg(vm, daemon_args::arg_max_concurrency))
diff --git a/src/p2p/connection_basic.cpp b/src/p2p/connection_basic.cpp
index c0b73bc3e..981a02882 100644
--- a/src/p2p/connection_basic.cpp
+++ b/src/p2p/connection_basic.cpp
@@ -161,16 +161,16 @@ connection_basic::connection_basic(boost::asio::io_service& io_service, std::ato
mI->m_peer_number = sock_number.fetch_add(1); // use, and increase the generated number
string remote_addr_str = "?";
- try { remote_addr_str = socket_.remote_endpoint().address().to_string(); } catch(...){} ;
+ try { boost::system::error_code e; remote_addr_str = socket_.remote_endpoint(e).address().to_string(); } catch(...){} ;
_note("Spawned connection p2p#"<<mI->m_peer_number<<" to " << remote_addr_str << " currently we have sockets count:" << m_ref_sock_count);
//boost::filesystem::create_directories("log/dr-monero/net/");
}
-connection_basic::~connection_basic() {
+connection_basic::~connection_basic() noexcept(false) {
string remote_addr_str = "?";
m_ref_sock_count--;
- try { remote_addr_str = socket_.remote_endpoint().address().to_string(); } catch(...){} ;
+ try { boost::system::error_code e; remote_addr_str = socket_.remote_endpoint(e).address().to_string(); } catch(...){} ;
_note("Destructing connection p2p#"<<mI->m_peer_number << " to " << remote_addr_str);
}
diff --git a/src/p2p/connection_basic.hpp b/src/p2p/connection_basic.hpp
index 8be798735..5452fa6fb 100644
--- a/src/p2p/connection_basic.hpp
+++ b/src/p2p/connection_basic.hpp
@@ -103,7 +103,7 @@ class connection_basic { // not-templated base class for rapid developmet of som
// first counter is the ++/-- count of current sockets, the other socket_number is only-increasing ++ number generator
connection_basic(boost::asio::io_service& io_service, std::atomic<long> &ref_sock_count, std::atomic<long> &sock_number);
- virtual ~connection_basic();
+ virtual ~connection_basic() noexcept(false);
// various handlers to be called from connection class:
void do_send_handler_write(const void * ptr , size_t cb);
diff --git a/src/p2p/data_logger.cpp b/src/p2p/data_logger.cpp
index ca0726c5f..fe54aef63 100644
--- a/src/p2p/data_logger.cpp
+++ b/src/p2p/data_logger.cpp
@@ -103,7 +103,7 @@ namespace net_utils
_info_c("dbg/data","Data logger constructed");
}
- data_logger::~data_logger() {
+ data_logger::~data_logger() noexcept(false) {
_note_c("dbg/data","Destructor of the data logger");
{
boost::lock_guard<boost::mutex> lock(mMutex);
diff --git a/src/p2p/data_logger.hpp b/src/p2p/data_logger.hpp
index 148afc0ab..278d08bfc 100644
--- a/src/p2p/data_logger.hpp
+++ b/src/p2p/data_logger.hpp
@@ -55,7 +55,7 @@ enum class data_logger_state { state_before_init, state_during_init, state_ready
public:
static data_logger &get_instance(); ///< singleton
static void kill_instance(); ///< call this before ending main to allow more gracefull shutdown of the main singleton and it's background thread
- ~data_logger(); ///< destr, will be called when singleton is killed when global m_obj dies. will kill theads etc
+ ~data_logger() noexcept(false); ///< destr, will be called when singleton is killed when global m_obj dies. will kill theads etc
private:
data_logger(); ///< constructor is private, use only via singleton get_instance
diff --git a/tests/unit_tests/hardfork.cpp b/tests/unit_tests/hardfork.cpp
index 6d4a100df..1d1f85945 100644
--- a/tests/unit_tests/hardfork.cpp
+++ b/tests/unit_tests/hardfork.cpp
@@ -129,7 +129,9 @@ public:
return starting_height[version];
}
virtual void set_hard_fork_version(uint64_t height, uint8_t version) {
- if (versions.size() <= height) versions.resize(height+1); versions[height] = version;
+ if (versions.size() <= height)
+ versions.resize(height+1);
+ versions[height] = version;
}
virtual uint8_t get_hard_fork_version(uint64_t height) const {
return versions[height];