diff options
Diffstat (limited to 'contrib/epee')
-rw-r--r-- | contrib/epee/include/console_handler.h | 9 | ||||
-rw-r--r-- | contrib/epee/include/md5_l.h | 2 | ||||
-rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 8 | ||||
-rw-r--r-- | contrib/epee/include/net/http_server_handlers_map2.h | 2 | ||||
-rw-r--r-- | contrib/epee/include/span.h | 3 | ||||
-rw-r--r-- | contrib/epee/include/string_tools.h | 4 |
6 files changed, 23 insertions, 5 deletions
diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h index 13747b0c8..1b716fca4 100644 --- a/contrib/epee/include/console_handler.h +++ b/contrib/epee/include/console_handler.h @@ -605,10 +605,17 @@ eof: std::unique_ptr<boost::thread> m_console_thread; async_console_handler m_console_handler; public: + ~console_handlers_binder() { + stop_handling(); + if (m_console_thread.get() != nullptr) + { + m_console_thread->join(); + } + } + bool start_handling(std::function<std::string(void)> prompt, const std::string& usage_string = "", std::function<void(void)> exit_handler = NULL) { m_console_thread.reset(new boost::thread(boost::bind(&console_handlers_binder::run_handling, this, prompt, usage_string, exit_handler))); - m_console_thread->detach(); return true; } bool start_handling(const std::string &prompt, const std::string& usage_string = "", std::function<void(void)> exit_handler = NULL) diff --git a/contrib/epee/include/md5_l.h b/contrib/epee/include/md5_l.h index a45d91bc8..bc7122650 100644 --- a/contrib/epee/include/md5_l.h +++ b/contrib/epee/include/md5_l.h @@ -85,7 +85,7 @@ namespace md5 MD5Update( &ctx, input, ilen ); MD5Final( output, &ctx); - memset( &ctx, 0, sizeof( MD5_CTX) ); + memwipe( &ctx, sizeof( MD5_CTX )); return true; } diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 5d12f9466..128ff10aa 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -410,7 +410,12 @@ PRAGMA_WARNING_DISABLE_VS(4355) else { _dbg3("[sock " << socket().native_handle() << "] peer closed connection"); - if (m_ready_to_close) + bool do_shutdown = false; + CRITICAL_REGION_BEGIN(m_send_que_lock); + if(!m_send_que.size()) + do_shutdown = true; + CRITICAL_REGION_END(); + if (m_ready_to_close || do_shutdown) shutdown(); } m_ready_to_close = true; @@ -470,6 +475,7 @@ PRAGMA_WARNING_DISABLE_VS(4355) { MERROR("SSL handshake failed"); boost::interprocess::ipcdetail::atomic_write32(&m_want_close_connection, 1); + m_ready_to_close = true; bool do_shutdown = false; CRITICAL_REGION_BEGIN(m_send_que_lock); if(!m_send_que.size()) diff --git a/contrib/epee/include/net/http_server_handlers_map2.h b/contrib/epee/include/net/http_server_handlers_map2.h index 07ed8157b..0c0653cd6 100644 --- a/contrib/epee/include/net/http_server_handlers_map2.h +++ b/contrib/epee/include/net/http_server_handlers_map2.h @@ -120,6 +120,7 @@ #define BEGIN_JSON_RPC_MAP(uri) else if(query_info.m_URI == uri) \ { \ uint64_t ticks = epee::misc_utils::get_tick_count(); \ + response_info.m_mime_tipe = "application/json"; \ epee::serialization::portable_storage ps; \ if(!ps.load_from_json(query_info.m_body)) \ { \ @@ -148,6 +149,7 @@ #define PREPARE_OBJECTS_FROM_JSON(command_type) \ handled = true; \ + response_info.m_mime_tipe = "application/json"; \ boost::value_initialized<epee::json_rpc::request<command_type::request> > req_; \ epee::json_rpc::request<command_type::request>& req = static_cast<epee::json_rpc::request<command_type::request>&>(req_);\ if(!req.load(ps)) \ diff --git a/contrib/epee/include/span.h b/contrib/epee/include/span.h index e100452ca..59895535f 100644 --- a/contrib/epee/include/span.h +++ b/contrib/epee/include/span.h @@ -110,7 +110,8 @@ namespace epee constexpr std::size_t size() const noexcept { return len; } constexpr std::size_t size_bytes() const noexcept { return size() * sizeof(value_type); } - const T &operator[](size_t idx) const { return ptr[idx]; } + T &operator[](size_t idx) noexcept { return ptr[idx]; } + const T &operator[](size_t idx) const noexcept { return ptr[idx]; } private: T* ptr; diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h index 1be5eb5e1..319c0121b 100644 --- a/contrib/epee/include/string_tools.h +++ b/contrib/epee/include/string_tools.h @@ -188,8 +188,10 @@ POP_WARNINGS return boost::lexical_cast<std::string>(val); } //---------------------------------------------------------------------------- - inline std::string to_string_hex(uint32_t val) + template<typename T> + inline std::string to_string_hex(const T &val) { + static_assert(std::is_arithmetic<T>::value, "only arithmetic types"); std::stringstream ss; ss << std::hex << val; std::string s; |