forked from premiere/premiere-libtorrent
some errors cause asio to throw exceptions instead of returning the error in the passed in error_code&. catch the one in udp_socket
This commit is contained in:
parent
fe414878b2
commit
1be2b6dc1a
|
@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/array.hpp>
|
#include <boost/array.hpp>
|
||||||
|
#include <boost/system/system_error.hpp>
|
||||||
#if BOOST_VERSION < 103500
|
#if BOOST_VERSION < 103500
|
||||||
#include <asio/read.hpp>
|
#include <asio/read.hpp>
|
||||||
#else
|
#else
|
||||||
|
@ -471,8 +472,16 @@ void udp_socket::setup_read(udp::socket* s)
|
||||||
add_outstanding_async("udp_socket::on_read");
|
add_outstanding_async("udp_socket::on_read");
|
||||||
#endif
|
#endif
|
||||||
udp::endpoint ep;
|
udp::endpoint ep;
|
||||||
s->async_receive_from(asio::null_buffers()
|
TORRENT_TRY
|
||||||
, ep, boost::bind(&udp_socket::on_read, this, _1, s));
|
{
|
||||||
|
s->async_receive_from(asio::null_buffers()
|
||||||
|
, ep, boost::bind(&udp_socket::on_read, this, _1, s));
|
||||||
|
}
|
||||||
|
TORRENT_CATCH(boost::system::system_error& e)
|
||||||
|
{
|
||||||
|
get_io_service().post(boost::bind(&udp_socket::on_read
|
||||||
|
, this, e.code(), s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void udp_socket::wrap(udp::endpoint const& ep, char const* p, int len, error_code& ec)
|
void udp_socket::wrap(udp::endpoint const& ep, char const* p, int len, error_code& ec)
|
||||||
|
|
Loading…
Reference in New Issue