Change fc::canceled_exceptions thrown due to a socket operation being canceled into regular fc::exceptions -- we're reserving canceled_exception for canceling async tasks

This commit is contained in:
Eric Frias 2014-08-28 15:34:04 -04:00
parent 477d3397f6
commit f8472af119
2 changed files with 10 additions and 4 deletions

View file

@ -11,12 +11,15 @@ namespace fc {
else {
// elog( "%s", boost::system::system_error(ec).what() );
// p->set_exception( fc::copy_exception( boost::system::system_error(ec) ) );
#if 0
if( ec == boost::asio::error::operation_aborted )
{
p->set_exception( fc::exception_ptr( new fc::canceled_exception(
FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
}
else if( ec == boost::asio::error::eof )
else
#endif
if( ec == boost::asio::error::eof )
{
p->set_exception( fc::exception_ptr( new fc::eof_exception(
FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
@ -39,12 +42,15 @@ namespace fc {
p->set_value();
else
{
#if 0
if( ec == boost::asio::error::operation_aborted )
{
p->set_exception( fc::exception_ptr( new fc::canceled_exception(
FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
}
else if( ec == boost::asio::error::eof )
else
#endif
if( ec == boost::asio::error::eof )
{
p->set_exception( fc::exception_ptr( new fc::eof_exception(
FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );

View file

@ -115,7 +115,7 @@ namespace fc {
auto read_itr = _read_promises.find( udt_socket_id );
if( read_itr != _read_promises.end() )
{
read_itr->second->set_exception( fc::copy_exception( fc::canceled_exception() ) );
read_itr->second->set_exception( fc::copy_exception( fc::exception() ) );
_read_promises.erase(read_itr);
}
}
@ -123,7 +123,7 @@ namespace fc {
auto write_itr = _write_promises.find( udt_socket_id );
if( write_itr != _write_promises.end() )
{
write_itr->second->set_exception( fc::copy_exception( fc::canceled_exception() ) );
write_itr->second->set_exception( fc::copy_exception( fc::exception() ) );
_write_promises.erase(write_itr);
}
}