mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-13 00:28:03 +00:00
update libboost api #33
This commit is contained in:
parent
603a38a974
commit
93f5b87192
@ -434,7 +434,7 @@ eof:
|
|||||||
bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
|
bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
|
||||||
{
|
{
|
||||||
async_console_handler console_handler;
|
async_console_handler console_handler;
|
||||||
return console_handler.run(ptsrv, boost::bind<bool>(no_srv_param_adapter<t_server, t_handler>, _1, _2, handlr), prompt, usage);
|
return console_handler.run(ptsrv, boost::bind<bool>(no_srv_param_adapter<t_server, t_handler>, boost::placeholders::_1, boost::placeholders::_2, handlr), prompt, usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class t_server, class t_handler>
|
template<class t_server, class t_handler>
|
||||||
@ -564,7 +564,7 @@ eof:
|
|||||||
|
|
||||||
bool run_handling(std::function<std::string(void)> prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL)
|
bool run_handling(std::function<std::string(void)> prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL)
|
||||||
{
|
{
|
||||||
return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, _1), prompt, usage_string, exit_handler);
|
return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, boost::placeholders::_1), prompt, usage_string, exit_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_prompt()
|
void print_prompt()
|
||||||
@ -587,7 +587,7 @@ eof:
|
|||||||
|
|
||||||
// bool run_handling(t_server* psrv, const std::string& prompt, const std::string& usage_string)
|
// bool run_handling(t_server* psrv, const std::string& prompt, const std::string& usage_string)
|
||||||
// {
|
// {
|
||||||
// return m_console_handler.run(psrv, boost::bind(&srv_console_handlers_binder<t_server>::process_command_str, this, _1, _2), prompt, usage_string);
|
// return m_console_handler.run(psrv, boost::bind(&srv_console_handlers_binder<t_server>::process_command_str, this, boost::placeholders::_1, boost::placeholders::_2), prompt, usage_string);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// void stop_handling()
|
// void stop_handling()
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||||
@ -17,7 +17,7 @@
|
|||||||
// * Neither the name of the Andrey N. Sabelnikov nor the
|
// * Neither the name of the Andrey N. Sabelnikov nor the
|
||||||
// names of its contributors may be used to endorse or promote products
|
// names of its contributors may be used to endorse or promote products
|
||||||
// derived from this software without specific prior written permission.
|
// derived from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
// 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
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
@ -28,7 +28,7 @@
|
|||||||
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// 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
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -72,14 +72,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
|
|
||||||
template<class t_protocol_handler>
|
template<class t_protocol_handler>
|
||||||
connection<t_protocol_handler>::connection( boost::asio::io_service& io_service,
|
connection<t_protocol_handler>::connection( boost::asio::io_service& io_service,
|
||||||
typename t_protocol_handler::config_type& config,
|
typename t_protocol_handler::config_type& config,
|
||||||
std::atomic<long> &ref_sock_count, // the ++/-- counter
|
std::atomic<long> &ref_sock_count, // the ++/-- counter
|
||||||
std::atomic<long> &sock_number, // the only increasing ++ number generator
|
std::atomic<long> &sock_number, // the only increasing ++ number generator
|
||||||
i_connection_filter* &pfilter
|
i_connection_filter* &pfilter
|
||||||
,t_connection_type connection_type
|
,t_connection_type connection_type
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
connection_basic(io_service, ref_sock_count, sock_number),
|
connection_basic(io_service, ref_sock_count, sock_number),
|
||||||
m_protocol_handler(this, config, context),
|
m_protocol_handler(this, config, context),
|
||||||
m_pfilter( pfilter ),
|
m_pfilter( pfilter ),
|
||||||
m_connection_type( connection_type ),
|
m_connection_type( connection_type ),
|
||||||
@ -188,10 +188,10 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
socket_.set_option( optionTos );
|
socket_.set_option( optionTos );
|
||||||
//_dbg1("Set ToS flag to " << tos);
|
//_dbg1("Set ToS flag to " << tos);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::asio::ip::tcp::no_delay noDelayOption(false);
|
boost::asio::ip::tcp::no_delay noDelayOption(false);
|
||||||
socket_.set_option(noDelayOption);
|
socket_.set_option(noDelayOption);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
CATCH_ENTRY_L0("connection<t_protocol_handler>::start()", false);
|
CATCH_ENTRY_L0("connection<t_protocol_handler>::start()", false);
|
||||||
@ -290,7 +290,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
//_info("[sock " << socket_.native_handle() << "] Async read calledback.");
|
//_info("[sock " << socket_.native_handle() << "] Async read calledback.");
|
||||||
|
|
||||||
if (!e)
|
if (!e)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -298,7 +298,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
m_throttle_speed_in.handle_trafic_exact(bytes_transferred);
|
m_throttle_speed_in.handle_trafic_exact(bytes_transferred);
|
||||||
context.m_current_speed_down = m_throttle_speed_in.get_current_speed();
|
context.m_current_speed_down = m_throttle_speed_in.get_current_speed();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::network_throttle_manager::m_lock_get_global_throttle_in );
|
CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::network_throttle_manager::m_lock_get_global_throttle_in );
|
||||||
epee::net_utils::network_throttle_manager::network_throttle_manager::get_global_throttle_in().handle_trafic_exact(bytes_transferred);
|
epee::net_utils::network_throttle_manager::network_throttle_manager::get_global_throttle_in().handle_trafic_exact(bytes_transferred);
|
||||||
@ -314,7 +314,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::m_lock_get_global_throttle_in );
|
CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::m_lock_get_global_throttle_in );
|
||||||
delay = epee::net_utils::network_throttle_manager::get_global_throttle_in().get_sleep_time_after_tick( bytes_transferred );
|
delay = epee::net_utils::network_throttle_manager::get_global_throttle_in().get_sleep_time_after_tick( bytes_transferred );
|
||||||
}
|
}
|
||||||
|
|
||||||
delay *= 0.5;
|
delay *= 0.5;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
long int ms = (long int)(delay * 100);
|
long int ms = (long int)(delay * 100);
|
||||||
@ -323,7 +323,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
}
|
}
|
||||||
} while(delay > 0);
|
} while(delay > 0);
|
||||||
} // any form of sleeping
|
} // any form of sleeping
|
||||||
|
|
||||||
//_info("[sock " << socket_.native_handle() << "] RECV " << bytes_transferred);
|
//_info("[sock " << socket_.native_handle() << "] RECV " << bytes_transferred);
|
||||||
logger_handle_net_read(bytes_transferred);
|
logger_handle_net_read(bytes_transferred);
|
||||||
context.m_last_recv = time(NULL);
|
context.m_last_recv = time(NULL);
|
||||||
@ -331,7 +331,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
m_ready_to_close = false;
|
m_ready_to_close = false;
|
||||||
bool recv_res = m_protocol_handler.handle_recv(buffer_.data(), bytes_transferred);
|
bool recv_res = m_protocol_handler.handle_recv(buffer_.data(), bytes_transferred);
|
||||||
if(!recv_res)
|
if(!recv_res)
|
||||||
{
|
{
|
||||||
//_info("[sock " << socket_.native_handle() << "] protocol_want_close");
|
//_info("[sock " << socket_.native_handle() << "] protocol_want_close");
|
||||||
|
|
||||||
//some error in protocol, protocol handler ask to close connection
|
//some error in protocol, protocol handler ask to close connection
|
||||||
@ -389,15 +389,15 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
//multi thread model, we can't(!) wait in blocked call
|
//multi thread model, we can't(!) wait in blocked call
|
||||||
//so we make non blocking call and releasing CPU by calling sleep(0);
|
//so we make non blocking call and releasing CPU by calling sleep(0);
|
||||||
//if no handlers were called
|
//if no handlers were called
|
||||||
//TODO: Maybe we need to have have critical section + event + callback to upper protocol to
|
//TODO: Maybe we need to have have critical section + event + callback to upper protocol to
|
||||||
//ask it inside(!) critical region if we still able to go in event wait...
|
//ask it inside(!) critical region if we still able to go in event wait...
|
||||||
size_t cnt = socket_.get_io_service().poll_one();
|
size_t cnt = socket_.get_io_service().poll_one();
|
||||||
if(!cnt)
|
if(!cnt)
|
||||||
misc_utils::sleep_no_w(0);
|
misc_utils::sleep_no_w(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY_L0("connection<t_protocol_handler>::call_run_once_service_io", false);
|
CATCH_ENTRY_L0("connection<t_protocol_handler>::call_run_once_service_io", false);
|
||||||
}
|
}
|
||||||
@ -423,15 +423,15 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
|
|
||||||
if (allow_split && (cb > chunksize_max_unsigned)) {
|
if (allow_split && (cb > chunksize_max_unsigned)) {
|
||||||
{ // LOCK: chunking
|
{ // LOCK: chunking
|
||||||
epee::critical_region_t<decltype(m_chunking_lock)> send_guard(m_chunking_lock); // *** critical ***
|
epee::critical_region_t<decltype(m_chunking_lock)> send_guard(m_chunking_lock); // *** critical ***
|
||||||
|
|
||||||
MDEBUG("do_send() will SPLIT into small chunks, from packet="<<cb<<" B for ptr="<<ptr);
|
MDEBUG("do_send() will SPLIT into small chunks, from packet="<<cb<<" B for ptr="<<ptr);
|
||||||
t_safe all = cb; // all bytes to send
|
t_safe all = cb; // all bytes to send
|
||||||
t_safe pos = 0; // current sending position
|
t_safe pos = 0; // current sending position
|
||||||
// 01234567890
|
// 01234567890
|
||||||
// ^^^^ (pos=0, len=4) ; pos:=pos+len, pos=4
|
// ^^^^ (pos=0, len=4) ; pos:=pos+len, pos=4
|
||||||
// ^^^^ (pos=4, len=4) ; pos:=pos+len, pos=8
|
// ^^^^ (pos=4, len=4) ; pos:=pos+len, pos=8
|
||||||
// ^^^ (pos=8, len=4) ;
|
// ^^^ (pos=8, len=4) ;
|
||||||
|
|
||||||
// const size_t bufsize = chunksize_good; // TODO safecast
|
// const size_t bufsize = chunksize_good; // TODO safecast
|
||||||
// char* buf = new char[ bufsize ];
|
// char* buf = new char[ bufsize ];
|
||||||
@ -447,7 +447,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
unsigned long long int len_unsigned = static_cast<long long int>( len );
|
unsigned long long int len_unsigned = static_cast<long long int>( len );
|
||||||
CHECK_AND_ASSERT_MES(len>0, false, "len not strictly positive"); // (redundant)
|
CHECK_AND_ASSERT_MES(len>0, false, "len not strictly positive"); // (redundant)
|
||||||
CHECK_AND_ASSERT_MES(len_unsigned < std::numeric_limits<size_t>::max(), false, "Invalid len_unsigned"); // yeap we want strong < then max size, to be sure
|
CHECK_AND_ASSERT_MES(len_unsigned < std::numeric_limits<size_t>::max(), false, "Invalid len_unsigned"); // yeap we want strong < then max size, to be sure
|
||||||
|
|
||||||
void *chunk_start = ((char*)ptr) + pos;
|
void *chunk_start = ((char*)ptr) + pos;
|
||||||
MDEBUG("chunk_start="<<chunk_start<<" ptr="<<ptr<<" pos="<<pos);
|
MDEBUG("chunk_start="<<chunk_start<<" ptr="<<ptr<<" pos="<<pos);
|
||||||
CHECK_AND_ASSERT_MES(chunk_start >= ptr, false, "Pointer wraparound"); // not wrapped around address?
|
CHECK_AND_ASSERT_MES(chunk_start >= ptr, false, "Pointer wraparound"); // not wrapped around address?
|
||||||
@ -506,7 +506,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
context.m_send_cnt += cb;
|
context.m_send_cnt += cb;
|
||||||
//some data should be wrote to stream
|
//some data should be wrote to stream
|
||||||
//request complete
|
//request complete
|
||||||
|
|
||||||
// No sleeping here; sleeping is done once and for all in "handle_write"
|
// No sleeping here; sleeping is done once and for all in "handle_write"
|
||||||
|
|
||||||
m_send_que_lock.lock(); // *** critical ***
|
m_send_que_lock.lock(); // *** critical ***
|
||||||
@ -539,13 +539,13 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
|
|
||||||
m_send_que.resize(m_send_que.size()+1);
|
m_send_que.resize(m_send_que.size()+1);
|
||||||
m_send_que.back().assign((const char*)ptr, cb);
|
m_send_que.back().assign((const char*)ptr, cb);
|
||||||
|
|
||||||
if(m_send_que.size() > 1)
|
if(m_send_que.size() > 1)
|
||||||
{ // active operation should be in progress, nothing to do, just wait last operation callback
|
{ // active operation should be in progress, nothing to do, just wait last operation callback
|
||||||
auto size_now = cb;
|
auto size_now = cb;
|
||||||
MDEBUG("do_send_chunk() NOW just queues: packet="<<size_now<<" B, is added to queue-size="<<m_send_que.size());
|
MDEBUG("do_send_chunk() NOW just queues: packet="<<size_now<<" B, is added to queue-size="<<m_send_que.size());
|
||||||
//do_send_handler_delayed( ptr , size_now ); // (((H))) // empty function
|
//do_send_handler_delayed( ptr , size_now ); // (((H))) // empty function
|
||||||
|
|
||||||
LOG_TRACE_CC(context, "[sock " << socket_.native_handle() << "] Async send requested " << m_send_que.front().size());
|
LOG_TRACE_CC(context, "[sock " << socket_.native_handle() << "] Async send requested " << m_send_que.front().size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -566,14 +566,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
reset_timer(get_default_timeout(), false);
|
reset_timer(get_default_timeout(), false);
|
||||||
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now ) ,
|
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now ) ,
|
||||||
//strand_.wrap(
|
//strand_.wrap(
|
||||||
boost::bind(&connection<t_protocol_handler>::handle_write, self, _1, _2)
|
boost::bind(&connection<t_protocol_handler>::handle_write, self, boost::placeholders::_1, boost::placeholders::_2)
|
||||||
//)
|
//)
|
||||||
);
|
);
|
||||||
//_dbg3("(chunk): " << size_now);
|
//_dbg3("(chunk): " << size_now);
|
||||||
//logger_handle_net_write(size_now);
|
//logger_handle_net_write(size_now);
|
||||||
//_info("[sock " << socket_.native_handle() << "] Async send requested " << m_send_que.front().size());
|
//_info("[sock " << socket_.native_handle() << "] Async send requested " << m_send_que.front().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
//do_send_handler_stop( ptr , cb ); // empty function
|
//do_send_handler_stop( ptr , cb ); // empty function
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -685,7 +685,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
{
|
{
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY_L0("connection<t_protocol_handler>::close", false);
|
CATCH_ENTRY_L0("connection<t_protocol_handler>::close", false);
|
||||||
}
|
}
|
||||||
@ -748,9 +748,9 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
if (speed_limit_is_enabled())
|
if (speed_limit_is_enabled())
|
||||||
do_send_handler_write_from_queue(e, m_send_que.front().size() , m_send_que.size()); // (((H)))
|
do_send_handler_write_from_queue(e, m_send_que.front().size() , m_send_que.size()); // (((H)))
|
||||||
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size");
|
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size");
|
||||||
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now) ,
|
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now) ,
|
||||||
// strand_.wrap(
|
// strand_.wrap(
|
||||||
boost::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), _1, _2)
|
boost::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), boost::placeholders::_1, boost::placeholders::_2)
|
||||||
// )
|
// )
|
||||||
);
|
);
|
||||||
//_dbg3("(normal)" << size_now);
|
//_dbg3("(normal)" << size_now);
|
||||||
@ -768,7 +768,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
template<class t_protocol_handler>
|
template<class t_protocol_handler>
|
||||||
void connection<t_protocol_handler>::setRpcStation()
|
void connection<t_protocol_handler>::setRpcStation()
|
||||||
{
|
{
|
||||||
m_connection_type = e_connection_type_RPC;
|
m_connection_type = e_connection_type_RPC;
|
||||||
MDEBUG("set m_connection_type = RPC ");
|
MDEBUG("set m_connection_type = RPC ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,8 +787,8 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
m_io_service_local_instance(new boost::asio::io_service()),
|
m_io_service_local_instance(new boost::asio::io_service()),
|
||||||
io_service_(*m_io_service_local_instance.get()),
|
io_service_(*m_io_service_local_instance.get()),
|
||||||
acceptor_(io_service_),
|
acceptor_(io_service_),
|
||||||
m_stop_signal_sent(false), m_port(0),
|
m_stop_signal_sent(false), m_port(0),
|
||||||
m_sock_count(0), m_sock_number(0), m_threads_count(0),
|
m_sock_count(0), m_sock_number(0), m_threads_count(0),
|
||||||
m_pfilter(NULL), m_thread_index(0),
|
m_pfilter(NULL), m_thread_index(0),
|
||||||
m_connection_type( connection_type ),
|
m_connection_type( connection_type ),
|
||||||
new_connection_()
|
new_connection_()
|
||||||
@ -801,8 +801,8 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
boosted_tcp_server<t_protocol_handler>::boosted_tcp_server(boost::asio::io_service& extarnal_io_service, t_connection_type connection_type) :
|
boosted_tcp_server<t_protocol_handler>::boosted_tcp_server(boost::asio::io_service& extarnal_io_service, t_connection_type connection_type) :
|
||||||
io_service_(extarnal_io_service),
|
io_service_(extarnal_io_service),
|
||||||
acceptor_(io_service_),
|
acceptor_(io_service_),
|
||||||
m_stop_signal_sent(false), m_port(0),
|
m_stop_signal_sent(false), m_port(0),
|
||||||
m_sock_count(0), m_sock_number(0), m_threads_count(0),
|
m_sock_count(0), m_sock_number(0), m_threads_count(0),
|
||||||
m_pfilter(NULL), m_thread_index(0),
|
m_pfilter(NULL), m_thread_index(0),
|
||||||
m_connection_type(connection_type),
|
m_connection_type(connection_type),
|
||||||
new_connection_()
|
new_connection_()
|
||||||
@ -819,7 +819,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
template<class t_protocol_handler>
|
template<class t_protocol_handler>
|
||||||
void boosted_tcp_server<t_protocol_handler>::create_server_type_map()
|
void boosted_tcp_server<t_protocol_handler>::create_server_type_map()
|
||||||
{
|
{
|
||||||
server_type_map["NET"] = e_connection_type_NET;
|
server_type_map["NET"] = e_connection_type_NET;
|
||||||
server_type_map["RPC"] = e_connection_type_RPC;
|
server_type_map["RPC"] = e_connection_type_RPC;
|
||||||
@ -866,7 +866,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
PUSH_WARNINGS
|
PUSH_WARNINGS
|
||||||
DISABLE_GCC_WARNING(maybe-uninitialized)
|
DISABLE_GCC_WARNING(maybe-uninitialized)
|
||||||
template<class t_protocol_handler>
|
template<class t_protocol_handler>
|
||||||
bool boosted_tcp_server<t_protocol_handler>::init_server(const std::string port, const std::string& address)
|
bool boosted_tcp_server<t_protocol_handler>::init_server(const std::string port, const std::string& address)
|
||||||
{
|
{
|
||||||
uint32_t p = 0;
|
uint32_t p = 0;
|
||||||
|
|
||||||
@ -882,7 +882,7 @@ POP_WARNINGS
|
|||||||
bool boosted_tcp_server<t_protocol_handler>::worker_thread()
|
bool boosted_tcp_server<t_protocol_handler>::worker_thread()
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
uint32_t local_thr_index = boost::interprocess::ipcdetail::atomic_inc32(&m_thread_index);
|
uint32_t local_thr_index = boost::interprocess::ipcdetail::atomic_inc32(&m_thread_index);
|
||||||
std::string thread_name = std::string("[") + m_thread_name_prefix;
|
std::string thread_name = std::string("[") + m_thread_name_prefix;
|
||||||
thread_name += boost::to_string(local_thr_index) + "]";
|
thread_name += boost::to_string(local_thr_index) + "]";
|
||||||
MLOG_SET_THREAD_NAME(thread_name);
|
MLOG_SET_THREAD_NAME(thread_name);
|
||||||
@ -954,7 +954,7 @@ POP_WARNINGS
|
|||||||
m_threads.clear();
|
m_threads.clear();
|
||||||
_fact("JOINING all threads - DONE");
|
_fact("JOINING all threads - DONE");
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_dbg1("Reiniting OK.");
|
_dbg1("Reiniting OK.");
|
||||||
return true;
|
return true;
|
||||||
@ -1089,7 +1089,7 @@ POP_WARNINGS
|
|||||||
connections_mutex.unlock();
|
connections_mutex.unlock();
|
||||||
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){ CRITICAL_REGION_LOCAL(connections_mutex); connections_.erase(new_connection_l); });
|
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){ CRITICAL_REGION_LOCAL(connections_mutex); connections_.erase(new_connection_l); });
|
||||||
boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
|
boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
boost::asio::ip::tcp::resolver resolver(io_service_);
|
boost::asio::ip::tcp::resolver resolver(io_service_);
|
||||||
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::query::canonical_name);
|
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::query::canonical_name);
|
||||||
@ -1105,7 +1105,7 @@ POP_WARNINGS
|
|||||||
|
|
||||||
//boost::asio::ip::tcp::endpoint remote_endpoint(boost::asio::ip::address::from_string(addr.c_str()), port);
|
//boost::asio::ip::tcp::endpoint remote_endpoint(boost::asio::ip::address::from_string(addr.c_str()), port);
|
||||||
boost::asio::ip::tcp::endpoint remote_endpoint(*iterator);
|
boost::asio::ip::tcp::endpoint remote_endpoint(*iterator);
|
||||||
|
|
||||||
sock_.open(remote_endpoint.protocol());
|
sock_.open(remote_endpoint.protocol());
|
||||||
if(bind_ip != "0.0.0.0" && bind_ip != "0" && bind_ip != "" )
|
if(bind_ip != "0.0.0.0" && bind_ip != "0" && bind_ip != "" )
|
||||||
{
|
{
|
||||||
@ -1143,7 +1143,7 @@ POP_WARNINGS
|
|||||||
shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock();
|
shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock();
|
||||||
};
|
};
|
||||||
|
|
||||||
sock_.async_connect(remote_endpoint, boost::bind<void>(connect_callback, _1, local_shared_context));
|
sock_.async_connect(remote_endpoint, boost::bind<void>(connect_callback, boost::placeholders::_1, local_shared_context));
|
||||||
while(local_shared_context->ec == boost::asio::error::would_block)
|
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));
|
bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout));
|
||||||
@ -1187,7 +1187,7 @@ POP_WARNINGS
|
|||||||
{
|
{
|
||||||
_erro("[sock " << new_connection_l->socket().native_handle() << "] Failed to start connection, connections_count = " << m_sock_count);
|
_erro("[sock " << new_connection_l->socket().native_handle() << "] Failed to start connection, connections_count = " << m_sock_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_connection_l->save_dbg_log();
|
new_connection_l->save_dbg_log();
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
@ -1198,7 +1198,7 @@ POP_WARNINGS
|
|||||||
template<class t_protocol_handler> template<class t_callback>
|
template<class t_protocol_handler> template<class t_callback>
|
||||||
bool boosted_tcp_server<t_protocol_handler>::connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeout, const t_callback &cb, const std::string& bind_ip)
|
bool boosted_tcp_server<t_protocol_handler>::connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeout, const t_callback &cb, const std::string& bind_ip)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
connection_ptr new_connection_l(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type) );
|
connection_ptr new_connection_l(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type) );
|
||||||
connections_mutex.lock();
|
connections_mutex.lock();
|
||||||
connections_.insert(new_connection_l);
|
connections_.insert(new_connection_l);
|
||||||
@ -1206,7 +1206,7 @@ POP_WARNINGS
|
|||||||
connections_mutex.unlock();
|
connections_mutex.unlock();
|
||||||
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){ CRITICAL_REGION_LOCAL(connections_mutex); connections_.erase(new_connection_l); });
|
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){ CRITICAL_REGION_LOCAL(connections_mutex); connections_.erase(new_connection_l); });
|
||||||
boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
|
boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
boost::asio::ip::tcp::resolver resolver(io_service_);
|
boost::asio::ip::tcp::resolver resolver(io_service_);
|
||||||
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::query::canonical_name);
|
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::query::canonical_name);
|
||||||
@ -1219,7 +1219,7 @@ POP_WARNINGS
|
|||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
boost::asio::ip::tcp::endpoint remote_endpoint(*iterator);
|
boost::asio::ip::tcp::endpoint remote_endpoint(*iterator);
|
||||||
|
|
||||||
sock_.open(remote_endpoint.protocol());
|
sock_.open(remote_endpoint.protocol());
|
||||||
if(bind_ip != "0.0.0.0" && bind_ip != "0" && bind_ip != "" )
|
if(bind_ip != "0.0.0.0" && bind_ip != "0" && bind_ip != "" )
|
||||||
{
|
{
|
||||||
@ -1234,13 +1234,13 @@ POP_WARNINGS
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<boost::asio::deadline_timer> sh_deadline(new boost::asio::deadline_timer(io_service_));
|
boost::shared_ptr<boost::asio::deadline_timer> sh_deadline(new boost::asio::deadline_timer(io_service_));
|
||||||
//start deadline
|
//start deadline
|
||||||
sh_deadline->expires_from_now(boost::posix_time::milliseconds(conn_timeout));
|
sh_deadline->expires_from_now(boost::posix_time::milliseconds(conn_timeout));
|
||||||
sh_deadline->async_wait([=](const boost::system::error_code& error)
|
sh_deadline->async_wait([=](const boost::system::error_code& error)
|
||||||
{
|
{
|
||||||
if(error != boost::asio::error::operation_aborted)
|
if(error != boost::asio::error::operation_aborted)
|
||||||
{
|
{
|
||||||
_dbg3("Failed to connect to " << adr << ':' << port << ", because of timeout (" << conn_timeout << ")");
|
_dbg3("Failed to connect to " << adr << ':' << port << ", because of timeout (" << conn_timeout << ")");
|
||||||
new_connection_l->socket().close();
|
new_connection_l->socket().close();
|
||||||
@ -1288,7 +1288,7 @@ POP_WARNINGS
|
|||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY_L0("boosted_tcp_server<t_protocol_handler>::connect_async", false);
|
CATCH_ENTRY_L0("boosted_tcp_server<t_protocol_handler>::connect_async", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
PRAGMA_WARNING_POP
|
PRAGMA_WARNING_POP
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
||||||
@ -11,7 +11,7 @@
|
|||||||
// * Neither the name of the Andrey N. Sabelnikov nor the
|
// * Neither the name of the Andrey N. Sabelnikov nor the
|
||||||
// names of its contributors may be used to endorse or promote products
|
// names of its contributors may be used to endorse or promote products
|
||||||
// derived from this software without specific prior written permission.
|
// derived from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
// 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
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
@ -22,7 +22,7 @@
|
|||||||
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// 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
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ namespace epee
|
|||||||
const_cast<t_arg&>(out_struct).store(stg);//TODO: add true const support to searilzation
|
const_cast<t_arg&>(out_struct).store(stg);//TODO: add true const support to searilzation
|
||||||
std::string buff_to_send;
|
std::string buff_to_send;
|
||||||
stg.store_to_binary(buff_to_send);
|
stg.store_to_binary(buff_to_send);
|
||||||
int res = transport.invoke_async(command, buff_to_send, conn_id, [cb, command](int code, const std::string& buff, typename t_transport::connection_context& context)->bool
|
int res = transport.invoke_async(command, buff_to_send, conn_id, [cb, command](int code, const std::string& buff, typename t_transport::connection_context& context)->bool
|
||||||
{
|
{
|
||||||
t_result result_struct = AUTO_VAL_INIT(result_struct);
|
t_result result_struct = AUTO_VAL_INIT(result_struct);
|
||||||
if( code <=0 )
|
if( code <=0 )
|
||||||
@ -219,14 +219,14 @@ namespace epee
|
|||||||
{ \
|
{ \
|
||||||
bool handled = false; \
|
bool handled = false; \
|
||||||
return handle_invoke_map(false, command, in_buff, buff_out, context, handled); \
|
return handle_invoke_map(false, command, in_buff, buff_out, context, handled); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHAIN_LEVIN_NOTIFY_MAP2(context_type) \
|
#define CHAIN_LEVIN_NOTIFY_MAP2(context_type) \
|
||||||
int notify(int command, const std::string& in_buff, context_type& context) \
|
int notify(int command, const std::string& in_buff, context_type& context) \
|
||||||
{ \
|
{ \
|
||||||
bool handled = false; std::string fake_str;\
|
bool handled = false; std::string fake_str;\
|
||||||
return handle_invoke_map(true, command, in_buff, fake_str, context, handled); \
|
return handle_invoke_map(true, command, in_buff, fake_str, context, handled); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define CHAIN_LEVIN_INVOKE_MAP() \
|
#define CHAIN_LEVIN_INVOKE_MAP() \
|
||||||
@ -234,20 +234,20 @@ namespace epee
|
|||||||
{ \
|
{ \
|
||||||
bool handled = false; \
|
bool handled = false; \
|
||||||
return handle_invoke_map(false, command, in_buff, buff_out, context, handled); \
|
return handle_invoke_map(false, command, in_buff, buff_out, context, handled); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHAIN_LEVIN_NOTIFY_MAP() \
|
#define CHAIN_LEVIN_NOTIFY_MAP() \
|
||||||
int notify(int command, const std::string& in_buff, epee::net_utils::connection_context_base& context) \
|
int notify(int command, const std::string& in_buff, epee::net_utils::connection_context_base& context) \
|
||||||
{ \
|
{ \
|
||||||
bool handled = false; std::string fake_str;\
|
bool handled = false; std::string fake_str;\
|
||||||
return handle_invoke_map(true, command, in_buff, fake_str, context, handled); \
|
return handle_invoke_map(true, command, in_buff, fake_str, context, handled); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHAIN_LEVIN_NOTIFY_STUB() \
|
#define CHAIN_LEVIN_NOTIFY_STUB() \
|
||||||
int notify(int command, const std::string& in_buff, epee::net_utils::connection_context_base& context) \
|
int notify(int command, const std::string& in_buff, epee::net_utils::connection_context_base& context) \
|
||||||
{ \
|
{ \
|
||||||
return -1; \
|
return -1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BEGIN_INVOKE_MAP2(owner_type) \
|
#define BEGIN_INVOKE_MAP2(owner_type) \
|
||||||
template <class t_context> int handle_invoke_map(bool is_notify, int command, const std::string& in_buff, std::string& buff_out, t_context& context, bool& handled) \
|
template <class t_context> int handle_invoke_map(bool is_notify, int command, const std::string& in_buff, std::string& buff_out, t_context& context, bool& handled) \
|
||||||
@ -256,20 +256,20 @@ namespace epee
|
|||||||
|
|
||||||
#define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out) \
|
#define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out) \
|
||||||
if(!is_notify && command_id == command) \
|
if(!is_notify && command_id == command) \
|
||||||
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in, typename_out>(this, command, in_buff, buff_out, boost::bind(func, this, _1, _2, _3, _4), context);}
|
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in, typename_out>(this, command, in_buff, buff_out, boost::bind(func, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4), context);}
|
||||||
|
|
||||||
#define HANDLE_INVOKE_T2(COMMAND, func) \
|
#define HANDLE_INVOKE_T2(COMMAND, func) \
|
||||||
if(!is_notify && COMMAND::ID == command) \
|
if(!is_notify && COMMAND::ID == command) \
|
||||||
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename COMMAND::request, typename COMMAND::response>(command, in_buff, buff_out, boost::bind(func, this, _1, _2, _3, _4), context);}
|
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename COMMAND::request, typename COMMAND::response>(command, in_buff, buff_out, boost::bind(func, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4), context);}
|
||||||
|
|
||||||
|
|
||||||
#define HANDLE_NOTIFY2(command_id, func, type_name_in) \
|
#define HANDLE_NOTIFY2(command_id, func, type_name_in) \
|
||||||
if(is_notify && command_id == command) \
|
if(is_notify && command_id == command) \
|
||||||
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in>(this, command, in_buff, boost::bind(func, this, _1, _2, _3), context);}
|
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in>(this, command, in_buff, boost::bind(func, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3), context);}
|
||||||
|
|
||||||
#define HANDLE_NOTIFY_T2(NOTIFY, func) \
|
#define HANDLE_NOTIFY_T2(NOTIFY, func) \
|
||||||
if(is_notify && NOTIFY::ID == command) \
|
if(is_notify && NOTIFY::ID == command) \
|
||||||
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename NOTIFY::request>(this, command, in_buff, boost::bind(func, this, _1, _2, _3), context);}
|
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename NOTIFY::request>(this, command, in_buff, boost::bind(func, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3), context);}
|
||||||
|
|
||||||
|
|
||||||
#define CHAIN_INVOKE_MAP2(func) \
|
#define CHAIN_INVOKE_MAP2(func) \
|
||||||
@ -299,4 +299,3 @@ namespace epee
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ namespace
|
|||||||
|
|
||||||
template<typename... T>
|
template<typename... T>
|
||||||
std::array<char, 32> operator()(const T&... args) const
|
std::array<char, 32> operator()(const T&... args) const
|
||||||
{
|
{
|
||||||
md5::MD5_CTX ctx{};
|
md5::MD5_CTX ctx{};
|
||||||
md5::MD5Init(std::addressof(ctx));
|
md5::MD5Init(std::addressof(ctx));
|
||||||
boost::fusion::for_each(std::tie(args...), update{ctx});
|
boost::fusion::for_each(std::tie(args...), update{ctx});
|
||||||
@ -448,18 +448,18 @@ namespace
|
|||||||
};
|
};
|
||||||
|
|
||||||
field_table.add
|
field_table.add
|
||||||
(u8"algorithm", std::bind(parse_token{}, _1, _2, _3, std::bind(&auth_message::algorithm, _4)))
|
(u8"algorithm", std::bind(parse_token{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, std::bind(&auth_message::algorithm, boost::placeholders::_4)))
|
||||||
(u8"cnonce", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::cnonce, _4)))
|
(u8"cnonce", std::bind(parse_string{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, std::bind(&auth_message::cnonce, boost::placeholders::_4)))
|
||||||
(u8"domain", std::bind(parse_string{}, _1, _2, _3)) // ignore field
|
(u8"domain", std::bind(parse_string{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3)) // ignore field
|
||||||
(u8"nc", parse_nc{})
|
(u8"nc", parse_nc{})
|
||||||
(u8"nonce", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::nonce, _4)))
|
(u8"nonce", std::bind(parse_string{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, std::bind(&auth_message::nonce, boost::placeholders::_4)))
|
||||||
(u8"opaque", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::opaque, _4)))
|
(u8"opaque", std::bind(parse_string{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, std::bind(&auth_message::opaque, boost::placeholders::_4)))
|
||||||
(u8"qop", std::bind(parse_token{}, _1, _2, _3, std::bind(&auth_message::qop, _4)))
|
(u8"qop", std::bind(parse_token{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, std::bind(&auth_message::qop, boost::placeholders::_4)))
|
||||||
(u8"realm", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::realm, _4)))
|
(u8"realm", std::bind(parse_string{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, std::bind(&auth_message::realm, boost::placeholders::_4)))
|
||||||
(u8"response", parse_response{})
|
(u8"response", parse_response{})
|
||||||
(u8"stale", std::bind(parse_token{}, _1, _2, _3, std::bind(&auth_message::stale, _4)))
|
(u8"stale", std::bind(parse_token{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, std::bind(&auth_message::stale, boost::placeholders::_4)))
|
||||||
(u8"uri", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::uri, _4)))
|
(u8"uri", std::bind(parse_string{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, std::bind(&auth_message::uri, boost::placeholders::_4)))
|
||||||
(u8"username", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::username, _4)));
|
(u8"username", std::bind(parse_string{}, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, std::bind(&auth_message::username, boost::placeholders::_4)));
|
||||||
|
|
||||||
skip_whitespace = *(&qi::ascii::char_ >> qi::ascii::space);
|
skip_whitespace = *(&qi::ascii::char_ >> qi::ascii::space);
|
||||||
header = skip_whitespace >> qi::ascii::no_case[u8"digest"] >> skip_whitespace;
|
header = skip_whitespace >> qi::ascii::no_case[u8"digest"] >> skip_whitespace;
|
||||||
@ -471,9 +471,9 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<auth_message> operator()(const boost::string_ref request) const
|
boost::optional<auth_message> operator()(const boost::string_ref request) const
|
||||||
{
|
{
|
||||||
namespace qi = boost::spirit::qi;
|
namespace qi = boost::spirit::qi;
|
||||||
|
|
||||||
iterator current = request.begin();
|
iterator current = request.begin();
|
||||||
const iterator end = request.end();
|
const iterator end = request.end();
|
||||||
|
|
||||||
@ -656,7 +656,7 @@ namespace
|
|||||||
boost::iterator_range<iterator> response;
|
boost::iterator_range<iterator> response;
|
||||||
boost::iterator_range<iterator> stale;
|
boost::iterator_range<iterator> stale;
|
||||||
boost::iterator_range<iterator> uri;
|
boost::iterator_range<iterator> uri;
|
||||||
boost::iterator_range<iterator> username;
|
boost::iterator_range<iterator> username;
|
||||||
}; // auth_message
|
}; // auth_message
|
||||||
|
|
||||||
struct add_challenge
|
struct add_challenge
|
||||||
@ -677,7 +677,7 @@ namespace
|
|||||||
add_field(out, u8"realm", quoted(auth_realm));
|
add_field(out, u8"realm", quoted(auth_realm));
|
||||||
add_field(out, u8"nonce", quoted(nonce));
|
add_field(out, u8"nonce", quoted(nonce));
|
||||||
add_field(out, u8"stale", is_stale ? ceref("true") : ceref("false"));
|
add_field(out, u8"stale", is_stale ? ceref("true") : ceref("false"));
|
||||||
|
|
||||||
fields.push_back(std::make_pair(std::string(server_auth_field), std::move(out)));
|
fields.push_back(std::make_pair(std::string(server_auth_field), std::move(out)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -693,13 +693,13 @@ namespace
|
|||||||
rc.m_response_code = 401;
|
rc.m_response_code = 401;
|
||||||
rc.m_response_comment = u8"Unauthorized";
|
rc.m_response_comment = u8"Unauthorized";
|
||||||
rc.m_mime_tipe = u8"text/html";
|
rc.m_mime_tipe = u8"text/html";
|
||||||
rc.m_body =
|
rc.m_body =
|
||||||
u8"<html><head><title>Unauthorized Access</title></head><body><h1>401 Unauthorized</h1></body></html>";
|
u8"<html><head><title>Unauthorized Access</title></head><body><h1>401 Unauthorized</h1></body></html>";
|
||||||
|
|
||||||
boost::fusion::for_each(
|
boost::fusion::for_each(
|
||||||
digest_algorithms, add_challenge{nonce, rc.m_additional_fields, is_stale}
|
digest_algorithms, add_challenge{nonce, rc.m_additional_fields, is_stale}
|
||||||
);
|
);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -782,4 +782,3 @@ namespace epee
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,13 +215,13 @@ CNameConflictTracker::CNameConflictTracker (CTxMemPool &p)
|
|||||||
: txNameConflicts(std::make_shared<std::vector<CTransactionRef>>()), pool(p)
|
: txNameConflicts(std::make_shared<std::vector<CTransactionRef>>()), pool(p)
|
||||||
{
|
{
|
||||||
pool.NotifyEntryRemoved.connect (
|
pool.NotifyEntryRemoved.connect (
|
||||||
boost::bind (&ConflictTrackerNotifyEntryRemoved, this, _1, _2));
|
boost::bind (&ConflictTrackerNotifyEntryRemoved, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
CNameConflictTracker::~CNameConflictTracker ()
|
CNameConflictTracker::~CNameConflictTracker ()
|
||||||
{
|
{
|
||||||
pool.NotifyEntryRemoved.disconnect (
|
pool.NotifyEntryRemoved.disconnect (
|
||||||
boost::bind (&ConflictTrackerNotifyEntryRemoved, this, _1, _2));
|
boost::bind (&ConflictTrackerNotifyEntryRemoved, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1199,15 +1199,15 @@ static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, co
|
|||||||
void BitcoinGUI::subscribeToCoreSignals()
|
void BitcoinGUI::subscribeToCoreSignals()
|
||||||
{
|
{
|
||||||
// Connect signals to client
|
// Connect signals to client
|
||||||
uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
|
uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
uiInterface.ThreadSafeQuestion.connect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
|
uiInterface.ThreadSafeQuestion.connect(boost::bind(ThreadSafeMessageBox, this, boost::placeholders::_1, boost::placeholders::_3, boost::placeholders::_4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::unsubscribeFromCoreSignals()
|
void BitcoinGUI::unsubscribeFromCoreSignals()
|
||||||
{
|
{
|
||||||
// Disconnect signals from client
|
// Disconnect signals from client
|
||||||
uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
|
uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
uiInterface.ThreadSafeQuestion.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
|
uiInterface.ThreadSafeQuestion.disconnect(boost::bind(ThreadSafeMessageBox, this, boost::placeholders::_1, boost::placeholders::_3, boost::placeholders::_4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::toggleNetworkActive()
|
void BitcoinGUI::toggleNetworkActive()
|
||||||
|
@ -316,23 +316,23 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, const CB
|
|||||||
void ClientModel::subscribeToCoreSignals()
|
void ClientModel::subscribeToCoreSignals()
|
||||||
{
|
{
|
||||||
// Connect signals to client
|
// Connect signals to client
|
||||||
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
|
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, _1));
|
uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, boost::placeholders::_1));
|
||||||
uiInterface.NotifyNetworkActiveChanged.connect(boost::bind(NotifyNetworkActiveChanged, this, _1));
|
uiInterface.NotifyNetworkActiveChanged.connect(boost::bind(NotifyNetworkActiveChanged, this, boost::placeholders::_1));
|
||||||
uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this));
|
uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this));
|
||||||
uiInterface.BannedListChanged.connect(boost::bind(BannedListChanged, this));
|
uiInterface.BannedListChanged.connect(boost::bind(BannedListChanged, this));
|
||||||
uiInterface.NotifyBlockTip.connect(boost::bind(BlockTipChanged, this, _1, _2, false));
|
uiInterface.NotifyBlockTip.connect(boost::bind(BlockTipChanged, this, boost::placeholders::_1, boost::placeholders::_2, false));
|
||||||
uiInterface.NotifyHeaderTip.connect(boost::bind(BlockTipChanged, this, _1, _2, true));
|
uiInterface.NotifyHeaderTip.connect(boost::bind(BlockTipChanged, this, boost::placeholders::_1, boost::placeholders::_2, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientModel::unsubscribeFromCoreSignals()
|
void ClientModel::unsubscribeFromCoreSignals()
|
||||||
{
|
{
|
||||||
// Disconnect signals from client
|
// Disconnect signals from client
|
||||||
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
|
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, _1));
|
uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, boost::placeholders::_1));
|
||||||
uiInterface.NotifyNetworkActiveChanged.disconnect(boost::bind(NotifyNetworkActiveChanged, this, _1));
|
uiInterface.NotifyNetworkActiveChanged.disconnect(boost::bind(NotifyNetworkActiveChanged, this, boost::placeholders::_1));
|
||||||
uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this));
|
uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this));
|
||||||
uiInterface.BannedListChanged.disconnect(boost::bind(BannedListChanged, this));
|
uiInterface.BannedListChanged.disconnect(boost::bind(BannedListChanged, this));
|
||||||
uiInterface.NotifyBlockTip.disconnect(boost::bind(BlockTipChanged, this, _1, _2, false));
|
uiInterface.NotifyBlockTip.disconnect(boost::bind(BlockTipChanged, this, boost::placeholders::_1, boost::placeholders::_2, false));
|
||||||
uiInterface.NotifyHeaderTip.disconnect(boost::bind(BlockTipChanged, this, _1, _2, true));
|
uiInterface.NotifyHeaderTip.disconnect(boost::bind(BlockTipChanged, this, boost::placeholders::_1, boost::placeholders::_2, true));
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ static void ShowProgress(SplashScreen *splash, const std::string &title, int nPr
|
|||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
void SplashScreen::ConnectWallet(CWallet* wallet)
|
void SplashScreen::ConnectWallet(CWallet* wallet)
|
||||||
{
|
{
|
||||||
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2, false));
|
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2, false));
|
||||||
connectedWallets.push_back(wallet);
|
connectedWallets.push_back(wallet);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -189,21 +189,21 @@ void SplashScreen::ConnectWallet(CWallet* wallet)
|
|||||||
void SplashScreen::subscribeToCoreSignals()
|
void SplashScreen::subscribeToCoreSignals()
|
||||||
{
|
{
|
||||||
// Connect signals to client
|
// Connect signals to client
|
||||||
uiInterface.InitMessage.connect(boost::bind(InitMessage, this, _1));
|
uiInterface.InitMessage.connect(boost::bind(InitMessage, this, boost::placeholders::_1));
|
||||||
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2, _3));
|
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
uiInterface.LoadWallet.connect(boost::bind(&SplashScreen::ConnectWallet, this, _1));
|
uiInterface.LoadWallet.connect(boost::bind(&SplashScreen::ConnectWallet, this, boost::placeholders::_1));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::unsubscribeFromCoreSignals()
|
void SplashScreen::unsubscribeFromCoreSignals()
|
||||||
{
|
{
|
||||||
// Disconnect signals from client
|
// Disconnect signals from client
|
||||||
uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, _1));
|
uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, boost::placeholders::_1));
|
||||||
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2, _3));
|
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
for (CWallet* const & pwallet : connectedWallets) {
|
for (CWallet* const & pwallet : connectedWallets) {
|
||||||
pwallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2, false));
|
pwallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2, false));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -770,13 +770,13 @@ static void ShowProgress(TransactionTableModel *ttm, const std::string &title, i
|
|||||||
void TransactionTableModel::subscribeToCoreSignals()
|
void TransactionTableModel::subscribeToCoreSignals()
|
||||||
{
|
{
|
||||||
// Connect signals to wallet
|
// Connect signals to wallet
|
||||||
wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
|
wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
|
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransactionTableModel::unsubscribeFromCoreSignals()
|
void TransactionTableModel::unsubscribeFromCoreSignals()
|
||||||
{
|
{
|
||||||
// Disconnect signals from wallet
|
// Disconnect signals from wallet
|
||||||
wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
|
wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
|
wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
@ -532,21 +532,21 @@ static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly
|
|||||||
void WalletModel::subscribeToCoreSignals()
|
void WalletModel::subscribeToCoreSignals()
|
||||||
{
|
{
|
||||||
// Connect signals to wallet
|
// Connect signals to wallet
|
||||||
wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1));
|
wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, boost::placeholders::_1));
|
||||||
wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6));
|
wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5, boost::placeholders::_6));
|
||||||
wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
|
wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
|
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
wallet->NotifyWatchonlyChanged.connect(boost::bind(NotifyWatchonlyChanged, this, _1));
|
wallet->NotifyWatchonlyChanged.connect(boost::bind(NotifyWatchonlyChanged, this, boost::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WalletModel::unsubscribeFromCoreSignals()
|
void WalletModel::unsubscribeFromCoreSignals()
|
||||||
{
|
{
|
||||||
// Disconnect signals from wallet
|
// Disconnect signals from wallet
|
||||||
wallet->NotifyStatusChanged.disconnect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1));
|
wallet->NotifyStatusChanged.disconnect(boost::bind(&NotifyKeyStoreStatusChanged, this, boost::placeholders::_1));
|
||||||
wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6));
|
wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5, boost::placeholders::_6));
|
||||||
wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
|
wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
|
wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
wallet->NotifyWatchonlyChanged.disconnect(boost::bind(NotifyWatchonlyChanged, this, _1));
|
wallet->NotifyWatchonlyChanged.disconnect(boost::bind(NotifyWatchonlyChanged, this, boost::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// WalletModel::UnlockContext implementation
|
// WalletModel::UnlockContext implementation
|
||||||
|
@ -460,8 +460,8 @@ TorController::TorController(struct event_base* _base, const std::string& _targe
|
|||||||
if (!reconnect_ev)
|
if (!reconnect_ev)
|
||||||
LogPrintf("tor: Failed to create event for reconnection: out of memory?\n");
|
LogPrintf("tor: Failed to create event for reconnection: out of memory?\n");
|
||||||
// Start connection attempts immediately
|
// Start connection attempts immediately
|
||||||
if (!conn.Connect(_target, boost::bind(&TorController::connected_cb, this, _1),
|
if (!conn.Connect(_target, boost::bind(&TorController::connected_cb, this, boost::placeholders::_1),
|
||||||
boost::bind(&TorController::disconnected_cb, this, _1) )) {
|
boost::bind(&TorController::disconnected_cb, this, boost::placeholders::_1) )) {
|
||||||
LogPrintf("tor: Initiating connection to Tor control port %s failed\n", _target);
|
LogPrintf("tor: Initiating connection to Tor control port %s failed\n", _target);
|
||||||
}
|
}
|
||||||
// Read service private key if cached
|
// Read service private key if cached
|
||||||
@ -539,7 +539,7 @@ void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply&
|
|||||||
// Note that the 'virtual' port doesn't have to be the same as our internal port, but this is just a convenient
|
// Note that the 'virtual' port doesn't have to be the same as our internal port, but this is just a convenient
|
||||||
// choice. TODO; refactor the shutdown sequence some day.
|
// choice. TODO; refactor the shutdown sequence some day.
|
||||||
_conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, GetListenPort(), GetListenPort()),
|
_conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, GetListenPort(), GetListenPort()),
|
||||||
boost::bind(&TorController::add_onion_cb, this, _1, _2));
|
boost::bind(&TorController::add_onion_cb, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("tor: Authentication failed\n");
|
LogPrintf("tor: Authentication failed\n");
|
||||||
}
|
}
|
||||||
@ -598,7 +598,7 @@ void TorController::authchallenge_cb(TorControlConnection& _conn, const TorContr
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> computedClientHash = ComputeResponse(TOR_SAFE_CLIENTKEY, cookie, clientNonce, serverNonce);
|
std::vector<uint8_t> computedClientHash = ComputeResponse(TOR_SAFE_CLIENTKEY, cookie, clientNonce, serverNonce);
|
||||||
_conn.Command("AUTHENTICATE " + HexStr(computedClientHash), boost::bind(&TorController::auth_cb, this, _1, _2));
|
_conn.Command("AUTHENTICATE " + HexStr(computedClientHash), boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("tor: Invalid reply to AUTHCHALLENGE\n");
|
LogPrintf("tor: Invalid reply to AUTHCHALLENGE\n");
|
||||||
}
|
}
|
||||||
@ -647,23 +647,23 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro
|
|||||||
if (methods.count("HASHEDPASSWORD")) {
|
if (methods.count("HASHEDPASSWORD")) {
|
||||||
LogPrint(BCLog::TOR, "tor: Using HASHEDPASSWORD authentication\n");
|
LogPrint(BCLog::TOR, "tor: Using HASHEDPASSWORD authentication\n");
|
||||||
boost::replace_all(torpassword, "\"", "\\\"");
|
boost::replace_all(torpassword, "\"", "\\\"");
|
||||||
_conn.Command("AUTHENTICATE \"" + torpassword + "\"", boost::bind(&TorController::auth_cb, this, _1, _2));
|
_conn.Command("AUTHENTICATE \"" + torpassword + "\"", boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n");
|
LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n");
|
||||||
}
|
}
|
||||||
} else if (methods.count("NULL")) {
|
} else if (methods.count("NULL")) {
|
||||||
LogPrint(BCLog::TOR, "tor: Using NULL authentication\n");
|
LogPrint(BCLog::TOR, "tor: Using NULL authentication\n");
|
||||||
_conn.Command("AUTHENTICATE", boost::bind(&TorController::auth_cb, this, _1, _2));
|
_conn.Command("AUTHENTICATE", boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
} else if (methods.count("SAFECOOKIE")) {
|
} else if (methods.count("SAFECOOKIE")) {
|
||||||
// Cookie: hexdump -e '32/1 "%02x""\n"' ~/.tor/control_auth_cookie
|
// Cookie: hexdump -e '32/1 "%02x""\n"' ~/.tor/control_auth_cookie
|
||||||
LogPrint(BCLog::TOR, "tor: Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile);
|
LogPrint(BCLog::TOR, "tor: Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile);
|
||||||
std::pair<bool,std::string> status_cookie = ReadBinaryFile(cookiefile, TOR_COOKIE_SIZE);
|
std::pair<bool,std::string> status_cookie = ReadBinaryFile(cookiefile, TOR_COOKIE_SIZE);
|
||||||
if (status_cookie.first && status_cookie.second.size() == TOR_COOKIE_SIZE) {
|
if (status_cookie.first && status_cookie.second.size() == TOR_COOKIE_SIZE) {
|
||||||
// _conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), boost::bind(&TorController::auth_cb, this, _1, _2));
|
// _conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), boost::bind(&TorController::auth_cb, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
cookie = std::vector<uint8_t>(status_cookie.second.begin(), status_cookie.second.end());
|
cookie = std::vector<uint8_t>(status_cookie.second.begin(), status_cookie.second.end());
|
||||||
clientNonce = std::vector<uint8_t>(TOR_NONCE_SIZE, 0);
|
clientNonce = std::vector<uint8_t>(TOR_NONCE_SIZE, 0);
|
||||||
GetRandBytes(clientNonce.data(), TOR_NONCE_SIZE);
|
GetRandBytes(clientNonce.data(), TOR_NONCE_SIZE);
|
||||||
_conn.Command("AUTHCHALLENGE SAFECOOKIE " + HexStr(clientNonce), boost::bind(&TorController::authchallenge_cb, this, _1, _2));
|
_conn.Command("AUTHCHALLENGE SAFECOOKIE " + HexStr(clientNonce), boost::bind(&TorController::authchallenge_cb, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
} else {
|
} else {
|
||||||
if (status_cookie.first) {
|
if (status_cookie.first) {
|
||||||
LogPrintf("tor: Authentication cookie %s is not exactly %i bytes, as is required by the spec\n", cookiefile, TOR_COOKIE_SIZE);
|
LogPrintf("tor: Authentication cookie %s is not exactly %i bytes, as is required by the spec\n", cookiefile, TOR_COOKIE_SIZE);
|
||||||
@ -685,7 +685,7 @@ void TorController::connected_cb(TorControlConnection& _conn)
|
|||||||
{
|
{
|
||||||
reconnect_timeout = RECONNECT_TIMEOUT_START;
|
reconnect_timeout = RECONNECT_TIMEOUT_START;
|
||||||
// First send a PROTOCOLINFO command to figure out what authentication is expected
|
// First send a PROTOCOLINFO command to figure out what authentication is expected
|
||||||
if (!_conn.Command("PROTOCOLINFO 1", boost::bind(&TorController::protocolinfo_cb, this, _1, _2)))
|
if (!_conn.Command("PROTOCOLINFO 1", boost::bind(&TorController::protocolinfo_cb, this, boost::placeholders::_1, boost::placeholders::_2)))
|
||||||
LogPrintf("tor: Error sending initial protocolinfo command\n");
|
LogPrintf("tor: Error sending initial protocolinfo command\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,8 +712,8 @@ void TorController::Reconnect()
|
|||||||
/* Try to reconnect and reestablish if we get booted - for example, Tor
|
/* Try to reconnect and reestablish if we get booted - for example, Tor
|
||||||
* may be restarting.
|
* may be restarting.
|
||||||
*/
|
*/
|
||||||
if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, _1),
|
if (!conn.Connect(target, boost::bind(&TorController::connected_cb, this, boost::placeholders::_1),
|
||||||
boost::bind(&TorController::disconnected_cb, this, _1) )) {
|
boost::bind(&TorController::disconnected_cb, this, boost::placeholders::_1) )) {
|
||||||
LogPrintf("tor: Re-initiating connection to Tor control port %s failed\n", target);
|
LogPrintf("tor: Re-initiating connection to Tor control port %s failed\n", target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -773,4 +773,3 @@ void StopTorControl()
|
|||||||
gBase = nullptr;
|
gBase = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2355,11 +2355,11 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) {
|
explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) {
|
||||||
pool.NotifyEntryRemoved.connect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2));
|
pool.NotifyEntryRemoved.connect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
~ConnectTrace() {
|
~ConnectTrace() {
|
||||||
pool.NotifyEntryRemoved.disconnect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2));
|
pool.NotifyEntryRemoved.disconnect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlockConnected(CBlockIndex* pindex, std::shared_ptr<const CBlock> pblock) {
|
void BlockConnected(CBlockIndex* pindex, std::shared_ptr<const CBlock> pblock) {
|
||||||
|
@ -66,11 +66,11 @@ size_t CMainSignals::CallbacksPending() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CMainSignals::RegisterWithMempoolSignals(CTxMemPool& pool) {
|
void CMainSignals::RegisterWithMempoolSignals(CTxMemPool& pool) {
|
||||||
pool.NotifyEntryRemoved.connect(boost::bind(&CMainSignals::MempoolEntryRemoved, this, _1, _2));
|
pool.NotifyEntryRemoved.connect(boost::bind(&CMainSignals::MempoolEntryRemoved, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainSignals::UnregisterWithMempoolSignals(CTxMemPool& pool) {
|
void CMainSignals::UnregisterWithMempoolSignals(CTxMemPool& pool) {
|
||||||
pool.NotifyEntryRemoved.disconnect(boost::bind(&CMainSignals::MempoolEntryRemoved, this, _1, _2));
|
pool.NotifyEntryRemoved.disconnect(boost::bind(&CMainSignals::MempoolEntryRemoved, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
CMainSignals& GetMainSignals()
|
CMainSignals& GetMainSignals()
|
||||||
@ -79,37 +79,37 @@ CMainSignals& GetMainSignals()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RegisterValidationInterface(CValidationInterface* pwalletIn) {
|
void RegisterValidationInterface(CValidationInterface* pwalletIn) {
|
||||||
g_signals.m_internals->UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1, _2, _3));
|
g_signals.m_internals->UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
g_signals.m_internals->TransactionAddedToMempool.connect(boost::bind(&CValidationInterface::TransactionAddedToMempool, pwalletIn, _1));
|
g_signals.m_internals->TransactionAddedToMempool.connect(boost::bind(&CValidationInterface::TransactionAddedToMempool, pwalletIn, boost::placeholders::_1));
|
||||||
g_signals.m_internals->BlockConnected.connect(boost::bind(&CValidationInterface::BlockConnected, pwalletIn, _1, _2, _3));
|
g_signals.m_internals->BlockConnected.connect(boost::bind(&CValidationInterface::BlockConnected, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
g_signals.m_internals->BlockDisconnected.connect(boost::bind(&CValidationInterface::BlockDisconnected, pwalletIn, _1));
|
g_signals.m_internals->BlockDisconnected.connect(boost::bind(&CValidationInterface::BlockDisconnected, pwalletIn, boost::placeholders::_1));
|
||||||
g_signals.m_internals->TransactionRemovedFromMempool.connect(boost::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, _1));
|
g_signals.m_internals->TransactionRemovedFromMempool.connect(boost::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, boost::placeholders::_1));
|
||||||
g_signals.m_internals->SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
g_signals.m_internals->SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, boost::placeholders::_1));
|
||||||
g_signals.m_internals->Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1, _2));
|
g_signals.m_internals->Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
g_signals.m_internals->BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2));
|
g_signals.m_internals->BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
g_signals.m_internals->NewPoWValidBlock.connect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, _1, _2));
|
g_signals.m_internals->NewPoWValidBlock.connect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
|
|
||||||
/** Keva related */
|
/** Keva related */
|
||||||
g_signals.m_internals->KevaNamespaceCreated.connect(boost::bind(&CValidationInterface::KevaNamespaceCreated, pwalletIn, _1, _2, _3));
|
g_signals.m_internals->KevaNamespaceCreated.connect(boost::bind(&CValidationInterface::KevaNamespaceCreated, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
g_signals.m_internals->KevaUpdated.connect(boost::bind(&CValidationInterface::KevaUpdated, pwalletIn, _1, _2, _3, _4, _5));
|
g_signals.m_internals->KevaUpdated.connect(boost::bind(&CValidationInterface::KevaUpdated, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5));
|
||||||
g_signals.m_internals->KevaDeleted.connect(boost::bind(&CValidationInterface::KevaDeleted, pwalletIn, _1, _2, _3, _4));
|
g_signals.m_internals->KevaDeleted.connect(boost::bind(&CValidationInterface::KevaDeleted, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
|
void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
|
||||||
g_signals.m_internals->BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2));
|
g_signals.m_internals->BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
g_signals.m_internals->Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1, _2));
|
g_signals.m_internals->Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
g_signals.m_internals->SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
g_signals.m_internals->SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, boost::placeholders::_1));
|
||||||
g_signals.m_internals->TransactionAddedToMempool.disconnect(boost::bind(&CValidationInterface::TransactionAddedToMempool, pwalletIn, _1));
|
g_signals.m_internals->TransactionAddedToMempool.disconnect(boost::bind(&CValidationInterface::TransactionAddedToMempool, pwalletIn, boost::placeholders::_1));
|
||||||
g_signals.m_internals->BlockConnected.disconnect(boost::bind(&CValidationInterface::BlockConnected, pwalletIn, _1, _2, _3));
|
g_signals.m_internals->BlockConnected.disconnect(boost::bind(&CValidationInterface::BlockConnected, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
g_signals.m_internals->BlockDisconnected.disconnect(boost::bind(&CValidationInterface::BlockDisconnected, pwalletIn, _1));
|
g_signals.m_internals->BlockDisconnected.disconnect(boost::bind(&CValidationInterface::BlockDisconnected, pwalletIn, boost::placeholders::_1));
|
||||||
g_signals.m_internals->TransactionRemovedFromMempool.disconnect(boost::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, _1));
|
g_signals.m_internals->TransactionRemovedFromMempool.disconnect(boost::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, boost::placeholders::_1));
|
||||||
g_signals.m_internals->UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1, _2, _3));
|
g_signals.m_internals->UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
g_signals.m_internals->NewPoWValidBlock.disconnect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, _1, _2));
|
g_signals.m_internals->NewPoWValidBlock.disconnect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, boost::placeholders::_1, boost::placeholders::_2));
|
||||||
|
|
||||||
/** Keva related */
|
/** Keva related */
|
||||||
g_signals.m_internals->KevaNamespaceCreated.disconnect(boost::bind(&CValidationInterface::KevaNamespaceCreated, pwalletIn, _1, _2, _3));
|
g_signals.m_internals->KevaNamespaceCreated.disconnect(boost::bind(&CValidationInterface::KevaNamespaceCreated, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3));
|
||||||
g_signals.m_internals->KevaUpdated.disconnect(boost::bind(&CValidationInterface::KevaUpdated, pwalletIn, _1, _2, _3, _4, _5));
|
g_signals.m_internals->KevaUpdated.disconnect(boost::bind(&CValidationInterface::KevaUpdated, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5));
|
||||||
g_signals.m_internals->KevaDeleted.disconnect(boost::bind(&CValidationInterface::KevaDeleted, pwalletIn, _1, _2, _3, _4));
|
g_signals.m_internals->KevaDeleted.disconnect(boost::bind(&CValidationInterface::KevaDeleted, pwalletIn, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnregisterAllValidationInterfaces() {
|
void UnregisterAllValidationInterfaces() {
|
||||||
|
Loading…
Reference in New Issue
Block a user