aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/depends/README.md8
-rw-r--r--contrib/epee/include/net/http_server_handlers_map2.h26
-rw-r--r--contrib/epee/include/net/net_helper.h113
-rw-r--r--contrib/epee/include/string_coding.h94
4 files changed, 5 insertions, 236 deletions
diff --git a/contrib/depends/README.md b/contrib/depends/README.md
index 1aa5b276f..2f1d8424a 100644
--- a/contrib/depends/README.md
+++ b/contrib/depends/README.md
@@ -1,6 +1,6 @@
### Usage
-To build dependencies for the current arch+OS:
+To build dependencies for the current arch+OS, from this working directory:
```bash
make
@@ -20,10 +20,12 @@ make HOST=x86_64-w64-mingw32 -j4
A toolchain will be generated that's suitable for plugging into Monero's
cmake. In the above example, a dir named x86_64-w64-mingw32 will be
-created. To use it for Monero:
+created. To use it for Monero, from the top of the Monero source tree:
```bash
-cmake -DCMAKE_TOOLCHAIN=`pwd`/contrib/depends/x86_64-w64-mingw32
+mkdir build
+cd build
+cmake -DCMAKE_TOOLCHAIN_FILE=$PWD/../contrib/depends/x86_64-w64-mingw32/share/toolchain.cmake ..
```
Common `host-platform-triplets` for cross compilation are:
diff --git a/contrib/epee/include/net/http_server_handlers_map2.h b/contrib/epee/include/net/http_server_handlers_map2.h
index ffb3f3b7e..be8787669 100644
--- a/contrib/epee/include/net/http_server_handlers_map2.h
+++ b/contrib/epee/include/net/http_server_handlers_map2.h
@@ -63,10 +63,6 @@
bool handled = false; \
if(false) return true; //just a stub to have "else if"
-#define MAP_URI2(pattern, callback) else if(std::string::npos != query_info.m_URI.find(pattern)) return callback(query_info, response_info, &m_conn_context);
-
-#define MAP_URI_AUTO_XML2(s_pattern, callback_f, command_type) //TODO: don't think i ever again will use xml - ambiguous and "overtagged" format
-
#define MAP_URI_AUTO_JON2_IF(s_pattern, callback_f, command_type, cond) \
else if((query_info.m_URI == s_pattern) && (cond)) \
{ \
@@ -139,8 +135,6 @@
MDEBUG( s_pattern << "() processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms"); \
}
-#define CHAIN_URI_MAP2(callback) else {callback(query_info, response_info, m_conn_context);handled = true;}
-
#define END_URI_MAP2() return handled;}
@@ -225,26 +219,6 @@
#define MAP_JON_RPC_WE(method_name, callback_f, command_type) MAP_JON_RPC_WE_IF(method_name, callback_f, command_type, true)
-#define MAP_JON_RPC_WERI(method_name, callback_f, command_type) \
- else if(callback_name == method_name) \
-{ \
- PREPARE_OBJECTS_FROM_JSON(command_type) \
- epee::json_rpc::error_response fail_resp = AUTO_VAL_INIT(fail_resp); \
- fail_resp.jsonrpc = "2.0"; \
- fail_resp.id = req.id; \
- MINFO(m_conn_context << "calling RPC method " << method_name); \
- bool res = false; \
- try { res = callback_f(req.params, resp.result, fail_resp.error, response_info, &m_conn_context); } \
- catch (const std::exception &e) { MERROR(m_conn_context << "Failed to " << #callback_f << "(): " << e.what()); } \
- if (!res) \
- { \
- epee::serialization::store_t_to_json(static_cast<epee::json_rpc::error_response&>(fail_resp), response_info.m_body); \
- return true; \
- } \
- FINALIZE_OBJECTS_TO_JSON(method_name) \
- return true;\
-}
-
#define MAP_JON_RPC(method_name, callback_f, command_type) \
else if(callback_name == method_name) \
{ \
diff --git a/contrib/epee/include/net/net_helper.h b/contrib/epee/include/net/net_helper.h
index 0a35797fd..ee344561d 100644
--- a/contrib/epee/include/net/net_helper.h
+++ b/contrib/epee/include/net/net_helper.h
@@ -688,119 +688,6 @@ namespace net_utils
std::atomic<uint64_t> m_bytes_sent;
std::atomic<uint64_t> m_bytes_received;
};
-
-
- /************************************************************************/
- /* */
- /************************************************************************/
- class async_blocked_mode_client: public blocked_mode_client
- {
- public:
- async_blocked_mode_client():m_send_deadline(blocked_mode_client::m_io_service)
- {
-
- // No deadline is required until the first socket operation is started. We
- // set the deadline to positive infinity so that the actor takes no action
- // until a specific deadline is set.
- m_send_deadline.expires_at(boost::posix_time::pos_infin);
-
- // Start the persistent actor that checks for deadline expiry.
- check_send_deadline();
- }
- ~async_blocked_mode_client()
- {
- m_send_deadline.cancel();
- }
-
- bool shutdown()
- {
- blocked_mode_client::shutdown();
- m_send_deadline.cancel();
- return true;
- }
-
- inline
- bool send(const void* data, size_t sz)
- {
- try
- {
- /*
- m_send_deadline.expires_from_now(boost::posix_time::milliseconds(m_reciev_timeout));
-
- // Set up the variable that receives the result of the asynchronous
- // operation. The error code is set to would_block to signal that the
- // operation is incomplete. Asio guarantees that its asynchronous
- // operations will never fail with would_block, so any other value in
- // ec indicates completion.
- boost::system::error_code ec = boost::asio::error::would_block;
-
- // Start the asynchronous operation itself. The boost::lambda function
- // object is used as a callback and will update the ec variable when the
- // operation completes. The blocking_udp_client.cpp example shows how you
- // can use boost::bind rather than boost::lambda.
- boost::asio::async_write(m_socket, boost::asio::buffer(data, sz), boost::lambda::var(ec) = boost::lambda::_1);
-
- // Block until the asynchronous operation has completed.
- while(ec == boost::asio::error::would_block)
- {
- m_io_service.run_one();
- }*/
-
- boost::system::error_code ec;
-
- size_t writen = write(data, sz, ec);
-
- if (!writen || ec)
- {
- LOG_PRINT_L3("Problems at write: " << ec.message());
- return false;
- }else
- {
- m_send_deadline.expires_at(boost::posix_time::pos_infin);
- }
- }
-
- catch(const boost::system::system_error& er)
- {
- LOG_ERROR("Some problems at connect, message: " << er.what());
- return false;
- }
- catch(...)
- {
- LOG_ERROR("Some fatal problems.");
- return false;
- }
-
- return true;
- }
-
-
- private:
-
- boost::asio::deadline_timer m_send_deadline;
-
- void check_send_deadline()
- {
- // Check whether the deadline has passed. We compare the deadline against
- // the current time since a new asynchronous operation may have moved the
- // deadline before this actor had a chance to run.
- if (m_send_deadline.expires_at() <= boost::asio::deadline_timer::traits_type::now())
- {
- // The deadline has passed. The socket is closed so that any outstanding
- // asynchronous operations are cancelled. This allows the blocked
- // connect(), read_line() or write_line() functions to return.
- LOG_PRINT_L3("Timed out socket");
- m_ssl_socket->next_layer().close();
-
- // There is no longer an active deadline. The expiry is set to positive
- // infinity so that the actor takes no action until a new deadline is set.
- m_send_deadline.expires_at(boost::posix_time::pos_infin);
- }
-
- // Put the actor back to sleep.
- m_send_deadline.async_wait(boost::bind(&async_blocked_mode_client::check_send_deadline, this));
- }
- };
}
}
diff --git a/contrib/epee/include/string_coding.h b/contrib/epee/include/string_coding.h
index 82050ef96..0d9c6c244 100644
--- a/contrib/epee/include/string_coding.h
+++ b/contrib/epee/include/string_coding.h
@@ -34,100 +34,6 @@ namespace epee
{
namespace string_encoding
{
- inline std::string convert_to_ansii(const std::wstring& str_from)
- {
-
- std::string res(str_from.begin(), str_from.end());
- return res;
- /*
- std::string result;
- std::locale loc;
- for(unsigned int i= 0; i < str_from.size(); ++i)
- {
- result += std::use_facet<std::ctype<wchar_t> >(loc).narrow(str_from[i]);
- }
- return result;
- */
-
- //return boost::lexical_cast<std::string>(str_from);
- /*
- std::string str_trgt;
- if(!str_from.size())
- return str_trgt;
- int cb = ::WideCharToMultiByte( code_page, 0, str_from.data(), (__int32)str_from.size(), 0, 0, 0, 0 );
- if(!cb)
- return str_trgt;
- str_trgt.resize(cb);
- ::WideCharToMultiByte( code_page, 0, str_from.data(), (int)str_from.size(),
- (char*)str_trgt.data(), (int)str_trgt.size(), 0, 0);
- return str_trgt;*/
- }
-
- inline std::string convert_to_ansii(const std::string& str_from)
- {
- return str_from;
- }
-
- inline std::wstring convert_to_unicode(const std::string& str_from)
- {
- std::wstring result;
- std::locale loc;
- for(unsigned int i= 0; i < str_from.size(); ++i)
- {
- result += std::use_facet<std::ctype<wchar_t> >(loc).widen(str_from[i]);
- }
- return result;
-
- //return boost::lexical_cast<std::wstring>(str_from);
- /*
- std::wstring str_trgt;
- if(!str_from.size())
- return str_trgt;
-
- int cb = ::MultiByteToWideChar( code_page, 0, str_from.data(), (int)str_from.size(), 0, 0 );
- if(!cb)
- return str_trgt;
-
- str_trgt.resize(cb);
- ::MultiByteToWideChar( code_page, 0, str_from.data(),(int)str_from.size(),
- (wchar_t*)str_trgt.data(),(int)str_trgt.size());
- return str_trgt;*/
- }
- inline std::wstring convert_to_unicode(const std::wstring& str_from)
- {
- return str_from;
- }
-
- template<class target_string>
- inline target_string convert_to_t(const std::wstring& str_from);
-
- template<>
- inline std::string convert_to_t<std::string>(const std::wstring& str_from)
- {
- return convert_to_ansii(str_from);
- }
-
- template<>
- inline std::wstring convert_to_t<std::wstring>(const std::wstring& str_from)
- {
- return str_from;
- }
-
- template<class target_string>
- inline target_string convert_to_t(const std::string& str_from);
-
- template<>
- inline std::string convert_to_t<std::string>(const std::string& str_from)
- {
- return str_from;
- }
-
- template<>
- inline std::wstring convert_to_t<std::wstring>(const std::string& str_from)
- {
- return convert_to_unicode(str_from);
- }
-
inline
std::string& base64_chars()
{