merged udp_socket fix from libtorrent_aio

This commit is contained in:
Arvid Norberg 2012-07-15 02:16:02 +00:00
parent 8554f97486
commit 9f4697a11b
2 changed files with 4 additions and 3 deletions

View File

@ -170,7 +170,7 @@ namespace libtorrent
void on_writable(error_code const& ec, udp::socket* s); void on_writable(error_code const& ec, udp::socket* s);
void setup_read(udp::socket* s); void setup_read(udp::socket* s);
void on_read(udp::socket* s); void on_read(error_code const& ec, udp::socket* s);
void on_read_impl(udp::socket* sock, udp::endpoint const& ep void on_read_impl(udp::socket* sock, udp::endpoint const& ep
, error_code const& e, std::size_t bytes_transferred); , error_code const& e, std::size_t bytes_transferred);
void on_name_lookup(error_code const& e, tcp::resolver::iterator i); void on_name_lookup(error_code const& e, tcp::resolver::iterator i);

View File

@ -226,7 +226,7 @@ void udp_socket::on_writable(error_code const& ec, udp::socket* s)
} }
// called whenever the socket is readable // called whenever the socket is readable
void udp_socket::on_read(udp::socket* s) void udp_socket::on_read(error_code const& ec, udp::socket* s)
{ {
#if defined TORRENT_ASIO_DEBUGGING #if defined TORRENT_ASIO_DEBUGGING
complete_async("udp_socket::on_read"); complete_async("udp_socket::on_read");
@ -248,6 +248,7 @@ void udp_socket::on_read(udp::socket* s)
--m_v4_outstanding; --m_v4_outstanding;
} }
if (ec == asio::error::operation_aborted) return;
if (m_abort) return; if (m_abort) return;
CHECK_MAGIC; CHECK_MAGIC;
@ -430,7 +431,7 @@ void udp_socket::setup_read(udp::socket* s)
#endif #endif
udp::endpoint ep; udp::endpoint ep;
s->async_receive_from(asio::null_buffers() s->async_receive_from(asio::null_buffers()
, ep, boost::bind(&udp_socket::on_read, this, s)); , ep, boost::bind(&udp_socket::on_read, this, _1, 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)