Skip to content

Commit

Permalink
Change fc::canceled_exceptions thrown due to a socket operation being…
Browse files Browse the repository at this point in the history
… canceled into regular fc::exceptions -- we're reserving canceled_exception for canceling async tasks
  • Loading branch information
emfrias committed Aug 28, 2014
1 parent 477d339 commit f8472af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/asio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())) ) ) );
Expand All @@ -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())) ) ) );
Expand Down
4 changes: 2 additions & 2 deletions src/network/udt_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ 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);
}
}
{ synchronized(_write_promises_mutex)
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);
}
}
Expand Down

0 comments on commit f8472af

Please sign in to comment.