Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
sowle committed Nov 1, 2019
2 parents 0305c59 + 7ba96b6 commit 5e8e7bf
Show file tree
Hide file tree
Showing 59 changed files with 1,621 additions and 193 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "contrib/miniupnp"]
path = contrib/miniupnp
url = https://github.com/miniupnp/miniupnp
[submodule "contrib\\db\\libmdbx"]
path = contrib/db/libmdbx
url = https://github.com/leo-yuriev/libmdbx.git
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ endif()

set(USE_PCH FALSE CACHE BOOL "Use shared precompiled headers for MSVC")

include_directories(src contrib/eos_portable_archive contrib/db/liblmdb contrib contrib/epee/include "${CMAKE_BINARY_DIR}/version" "${CMAKE_BINARY_DIR}/contrib/zlib")
include_directories(src contrib/eos_portable_archive contrib contrib/epee/include "${CMAKE_BINARY_DIR}/version" "${CMAKE_BINARY_DIR}/contrib/zlib")

add_definitions(-DSTATICLIB)

set(TESTNET FALSE CACHE BOOL "Compile for testnet")
Expand Down Expand Up @@ -213,7 +214,12 @@ else()
endif()

set(BUILD_TESTS FALSE CACHE BOOL "Build Zano tests")
set(DISABLE_MDBX FALSE CACHE BOOL "Exclude mdbx from build(need for a first time)")
if(NOT DISABLE_MDBX)
add_definitions(-DENABLED_ENGINE_MDBX)
endif()


add_subdirectory(contrib)
add_subdirectory(src)

Expand Down
10 changes: 8 additions & 2 deletions contrib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ add_subdirectory(db)
add_subdirectory(ethereum)


set_property(TARGET upnpc-static PROPERTY FOLDER "contrib/miniupnp")
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "contrib")
set_property(TARGET zlibstatic PROPERTY FOLDER "contrib")
set_property(TARGET mdbx PROPERTY FOLDER "contrib")
set_property(TARGET lmdb PROPERTY FOLDER "contrib")
set_property(TARGET upnpc-static mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat minigzip zlib example PROPERTY FOLDER "unused")
if(MSVC)
set_property(TARGET ntdll_extra_target PROPERTY FOLDER "unused")
endif()


if(MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4244 /wd4267")
set_property(TARGET zlibstatic APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4267 /wd4267")
else()
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-discarded-qualifiers ")
set_property(TARGET zlibstatic APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-discarded-qualifiers ")
Expand Down
20 changes: 13 additions & 7 deletions contrib/db/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
add_subdirectory(liblmdb)
if(MSVC)
target_compile_options(lmdb PRIVATE /wd4996 /wd4503 /wd4345 /wd4267 /wd4244 /wd4146 /wd4333 /wd4172)
else()
# Warnings as used by LMDB itself (LMDB_0.9.23)
target_compile_options(lmdb PRIVATE -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized)
endif()

message("DB ENGINE: lmdb")
add_subdirectory(liblmdb)
if(MSVC)
target_compile_options(lmdb PRIVATE /wd4996 /wd4503 /wd4345 /wd4267 /wd4244 /wd4146 /wd4333 /wd4172)
else()
# Warnings as used by LMDB itself (LMDB_0.9.23)
target_compile_options(lmdb PRIVATE -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized)
endif()
if(NOT DISABLE_MDBX)
message("DB ENGINE: mdbx")
add_subdirectory(libmdbx)
endif()
1 change: 1 addition & 0 deletions contrib/db/libmdbx
Submodule libmdbx added at a0ec89
8 changes: 4 additions & 4 deletions contrib/epee/include/net/abstract_tcp_server2.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ class connection
volatile uint32_t& m_ref_sockets_count;
i_connection_filter*& m_pfilter;
volatile bool m_is_multithreaded;

//this should be the last one, because it could be wait on destructor, while other activities possible on other threads
t_protocol_handler m_protocol_handler;
//typename t_protocol_handler::config_type m_dummy_config;
std::list<boost::shared_ptr<connection<t_protocol_handler>>> m_self_refs; // add_ref/release support
critical_section m_self_refs_lock;

t_protocol_handler m_protocol_handler;
//this should be the last line with m_protocol_handler, because it could be wait on destructor, while other activities possible on other threads
//DON'T ADD ANYTHING HERE!!!
};

/************************************************************************/
Expand Down
5 changes: 5 additions & 0 deletions contrib/epee/include/net/levin_protocol_handler_async.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ class async_protocol_handler
bool add_invoke_response_handler(const callback_t& cb, uint64_t timeout, async_protocol_handler& con, int command)
{
CRITICAL_REGION_LOCAL(m_invoke_response_handlers_lock);
if (m_protocol_released)
{
LOG_PRINT_L0("ERROR: Adding response handler to a released object");
return false;
}
boost::shared_ptr<invoke_response_handler_base> handler(boost::make_shared<invoke_handler<callback_t>>(cb, timeout, con, command));
m_invoke_response_handlers.push_back(handler);
LOG_PRINT_L4("[LEVIN_PROTOCOL" << this << "] INVOKE_HANDLER_QUE: PUSH_BACK RESPONSE HANDLER");
Expand Down
26 changes: 13 additions & 13 deletions contrib/epee/include/net/net_utils_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,34 +117,34 @@ namespace net_utils
//some helpers


inline
std::string print_connection_context(const connection_context_base& ctx)
inline std::string print_connection_context(const connection_context_base& ctx)
{
std::stringstream ss;
ss << epee::string_tools::get_ip_string_from_int32(ctx.m_remote_ip) << ":" << ctx.m_remote_port << " " << epee::string_tools::get_str_from_guid_a(ctx.m_connection_id) << (ctx.m_is_income ? " INC":" OUT");
return ss.str();
}

inline
void print_connection_context_short(const connection_context_base& ctx, std::stringstream& ss)
inline std::ostream &operator <<(std::ostream &o, const connection_context_base& ctx)
{
ss << epee::string_tools::get_ip_string_from_int32(ctx.m_remote_ip) << ":" << ctx.m_remote_port << (ctx.m_is_income ? " INC" : " OUT");
}
o << epee::string_tools::get_ip_string_from_int32(ctx.m_remote_ip) << ":" << ctx.m_remote_port << (ctx.m_is_income ? " INC" : " OUT");
return o;
}

inline
std::string print_connection_context_short(const connection_context_base& ctx)
inline std::string print_connection_context_short(const connection_context_base& ctx)
{
std::stringstream ss;
print_connection_context_short(ctx, ss);
ss << ctx;
return ss.str();
}

inline std::string print_connection_context_list(const std::list<connection_context_base>& contexts)
inline std::string print_connection_context_list(const std::list<connection_context_base>& contexts, const std::string& delim = std::string("\n"))
{
std::stringstream ss;
for (auto& c : contexts)
{
ss << epee::string_tools::get_ip_string_from_int32(c.m_remote_ip) << ":" << c.m_remote_port << (c.m_is_income ? " INC" : " OUT") << ENDL;
if (ss.tellp())
ss << delim;
ss << c;
}
return ss.str();
}
Expand Down Expand Up @@ -179,7 +179,7 @@ namespace net_utils

#define CHECK_AND_ASSERT_MES_CC(condition, return_val, err_message) CHECK_AND_ASSERT_MES(condition, return_val, "[" << epee::net_utils::print_connection_context_short(context) << "]" << err_message)

}
}
} // namespace net_utils
} // namespace epee

#endif //_NET_UTILS_BASE_H_
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ add_library(wallet ${WALLET})
add_dependencies(wallet version ${PCH_LIB_NAME})
ENABLE_SHARED_PCH(WALLET)

target_link_libraries(currency_core lmdb)
target_link_libraries(currency_core lmdb mdbx)

add_executable(daemon ${DAEMON} ${P2P} ${CURRENCY_PROTOCOL})
add_dependencies(daemon version)
Expand Down
1 change: 1 addition & 0 deletions src/common/command_line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ namespace command_line
const arg_descriptor<bool> arg_disable_stop_if_time_out_of_sync = { "disable-stop-if-time-out-of-sync", "Do not stop the daemon if serious time synchronization problem is detected", false, true };
const arg_descriptor<bool> arg_disable_stop_on_low_free_space = { "disable-stop-on-low-free-space", "Do not stop the daemon if free space at data dir is critically low", false, true };
const arg_descriptor<bool> arg_enable_offers_service = { "enable-offers-service", "Enables marketplace feature", false, false};
const arg_descriptor<std::string> arg_db_engine = { "db-engine", "Specify database engine for storage. May be \"lmdb\"(default) or \"mdbx\"", ARG_DB_ENGINE_LMDB, false };
}
4 changes: 4 additions & 0 deletions src/common/command_line.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ namespace command_line
return get_arg<bool, false>(vm, arg);
}

#define ARG_DB_ENGINE_LMDB "lmdb"
#define ARG_DB_ENGINE_MDBX "mdbx"


extern const arg_descriptor<bool> arg_help;
extern const arg_descriptor<bool> arg_version;
Expand All @@ -188,4 +191,5 @@ namespace command_line
extern const arg_descriptor<bool> arg_disable_stop_if_time_out_of_sync;
extern const arg_descriptor<bool> arg_disable_stop_on_low_free_space;
extern const arg_descriptor<bool> arg_enable_offers_service;
extern const arg_descriptor<std::string> arg_db_engine;
}
2 changes: 1 addition & 1 deletion src/common/db_abstract_accessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace tools
{
close();
}

void reset_backend(std::shared_ptr<i_db_backend> backend) { m_backend = backend; }
performance_data& get_performance_data_for_handle(container_handle h) const { return m_performance_data_map[h]; }
performance_data& get_performance_data_global() const { return m_gperformance_data; }

Expand Down
1 change: 1 addition & 0 deletions src/common/db_backend_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace tools
virtual bool clear(container_handle h) = 0;
virtual bool enumerate(container_handle h, i_db_callback* pcb)=0;
virtual bool get_stat_info(stat_info& si) = 0;
virtual const char* name()=0;
virtual ~i_db_backend(){};
};
}
Expand Down
4 changes: 4 additions & 0 deletions src/common/db_backend_lmdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@ namespace tools
}
return true;
}
const char* lmdb_db_backend::name()
{
return "lmdb";
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/common/db_backend_lmdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#pragma once

#include <thread>

#include "include_base_utils.h"
Expand Down Expand Up @@ -53,6 +54,7 @@ namespace tools
bool set(container_handle h, const char* k, size_t s, const char* v, size_t vs);
bool enumerate(container_handle h, i_db_callback* pcb);
bool get_stat_info(tools::db::stat_info& si);
const char* name();
//-------------------------------------------------------------------------------------
bool have_tx();
MDB_txn* get_current_tx();
Expand Down
Loading

0 comments on commit 5e8e7bf

Please sign in to comment.