Remove some unused asio completion functions
This commit is contained in:
parent
556f45fcbf
commit
87a2513981
2 changed files with 56 additions and 66 deletions
|
|
@ -39,17 +39,8 @@ namespace asio {
|
||||||
std::shared_ptr<const char> _buffer;
|
std::shared_ptr<const char> _buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
//void read_write_handler( const promise<size_t>::ptr& p,
|
|
||||||
// const boost::system::error_code& ec,
|
|
||||||
// size_t bytes_transferred );
|
|
||||||
void read_write_handler_ec( promise<size_t>* p,
|
|
||||||
boost::system::error_code* oec,
|
|
||||||
const boost::system::error_code& ec,
|
|
||||||
size_t bytes_transferred );
|
|
||||||
void error_handler( const promise<void>::ptr& p,
|
void error_handler( const promise<void>::ptr& p,
|
||||||
const boost::system::error_code& ec );
|
const boost::system::error_code& ec );
|
||||||
void error_handler_ec( promise<boost::system::error_code>* p,
|
|
||||||
const boost::system::error_code& ec );
|
|
||||||
|
|
||||||
template<typename C>
|
template<typename C>
|
||||||
struct non_blocking {
|
struct non_blocking {
|
||||||
|
|
|
||||||
33
src/asio.cpp
33
src/asio.cpp
|
|
@ -12,6 +12,7 @@ namespace fc {
|
||||||
{
|
{
|
||||||
//assert(false); // to detect anywhere we're not passing in a shared buffer
|
//assert(false); // to detect anywhere we're not passing in a shared buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_write_handler::operator()(const boost::system::error_code& ec, size_t bytes_transferred)
|
void read_write_handler::operator()(const boost::system::error_code& ec, size_t bytes_transferred)
|
||||||
{
|
{
|
||||||
//assert(false); // to detect anywhere we're not passing in a shared buffer
|
//assert(false); // to detect anywhere we're not passing in a shared buffer
|
||||||
|
|
@ -22,11 +23,13 @@ namespace fc {
|
||||||
else
|
else
|
||||||
_completion_promise->set_exception( fc::exception_ptr( new fc::exception( FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
|
_completion_promise->set_exception( fc::exception_ptr( new fc::exception( FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
read_write_handler_with_buffer::read_write_handler_with_buffer(const promise<size_t>::ptr& completion_promise,
|
read_write_handler_with_buffer::read_write_handler_with_buffer(const promise<size_t>::ptr& completion_promise,
|
||||||
const std::shared_ptr<const char>& buffer) :
|
const std::shared_ptr<const char>& buffer) :
|
||||||
_completion_promise(completion_promise),
|
_completion_promise(completion_promise),
|
||||||
_buffer(buffer)
|
_buffer(buffer)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void read_write_handler_with_buffer::operator()(const boost::system::error_code& ec, size_t bytes_transferred)
|
void read_write_handler_with_buffer::operator()(const boost::system::error_code& ec, size_t bytes_transferred)
|
||||||
{
|
{
|
||||||
if( !ec )
|
if( !ec )
|
||||||
|
|
@ -37,12 +40,9 @@ namespace fc {
|
||||||
_completion_promise->set_exception( fc::exception_ptr( new fc::exception( FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
|
_completion_promise->set_exception( fc::exception_ptr( new fc::exception( FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_write_handler_ec( promise<size_t>* p, boost::system::error_code* oec, const boost::system::error_code& ec, size_t bytes_transferred ) {
|
|
||||||
p->set_value(bytes_transferred);
|
|
||||||
*oec = ec;
|
|
||||||
}
|
|
||||||
void error_handler( const promise<void>::ptr& p,
|
void error_handler( const promise<void>::ptr& p,
|
||||||
const boost::system::error_code& ec ) {
|
const boost::system::error_code& ec )
|
||||||
|
{
|
||||||
if( !ec )
|
if( !ec )
|
||||||
p->set_value();
|
p->set_value();
|
||||||
else
|
else
|
||||||
|
|
@ -61,24 +61,23 @@ namespace fc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void error_handler_ec( promise<boost::system::error_code>* p,
|
|
||||||
const boost::system::error_code& ec ) {
|
|
||||||
p->set_value(ec);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename EndpointType, typename IteratorType>
|
template<typename EndpointType, typename IteratorType>
|
||||||
void resolve_handler(
|
void resolve_handler(const typename promise<std::vector<EndpointType> >::ptr& p,
|
||||||
const typename promise<std::vector<EndpointType> >::ptr& p,
|
|
||||||
const boost::system::error_code& ec,
|
const boost::system::error_code& ec,
|
||||||
IteratorType itr) {
|
IteratorType itr)
|
||||||
if( !ec ) {
|
{
|
||||||
|
if( !ec )
|
||||||
|
{
|
||||||
std::vector<EndpointType> eps;
|
std::vector<EndpointType> eps;
|
||||||
while( itr != IteratorType() ) {
|
while( itr != IteratorType() )
|
||||||
|
{
|
||||||
eps.push_back(*itr);
|
eps.push_back(*itr);
|
||||||
++itr;
|
++itr;
|
||||||
}
|
}
|
||||||
p->set_value( eps );
|
p->set_value( eps );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//elog( "%s", boost::system::system_error(ec).what() );
|
//elog( "%s", boost::system::system_error(ec).what() );
|
||||||
//p->set_exception( fc::copy_exception( boost::system::system_error(ec) ) );
|
//p->set_exception( fc::copy_exception( boost::system::system_error(ec) ) );
|
||||||
p->set_exception(
|
p->set_exception(
|
||||||
|
|
@ -87,7 +86,7 @@ namespace fc {
|
||||||
("message", boost::system::system_error(ec).what())) ) ) );
|
("message", boost::system::system_error(ec).what())) ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // end namespace detail
|
||||||
|
|
||||||
struct default_io_service_scope
|
struct default_io_service_scope
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue