forked from premiere/premiere-libtorrent
make handler exchange without copy->clone mem allocation (#1583)
make uTP handler exchange without copy->clone mem allocation
This commit is contained in:
parent
202386dd9d
commit
fffdd4703d
|
@ -898,7 +898,7 @@ void utp_stream::on_read(void* self, size_t bytes_transferred
|
|||
|
||||
TORRENT_ASSERT(s->m_read_handler);
|
||||
TORRENT_ASSERT(bytes_transferred > 0 || ec || s->m_impl->m_null_buffers);
|
||||
s->m_io_service.post(std::bind<void>(s->m_read_handler, ec, bytes_transferred));
|
||||
s->m_io_service.post(std::bind<void>(std::move(s->m_read_handler), ec, bytes_transferred));
|
||||
s->m_read_handler = nullptr;
|
||||
if (kill && s->m_impl)
|
||||
{
|
||||
|
@ -919,7 +919,7 @@ void utp_stream::on_write(void* self, size_t bytes_transferred
|
|||
|
||||
TORRENT_ASSERT(s->m_write_handler);
|
||||
TORRENT_ASSERT(bytes_transferred > 0 || ec);
|
||||
s->m_io_service.post(std::bind<void>(s->m_write_handler, ec, bytes_transferred));
|
||||
s->m_io_service.post(std::bind<void>(std::move(s->m_write_handler), ec, bytes_transferred));
|
||||
s->m_write_handler = nullptr;
|
||||
if (kill && s->m_impl)
|
||||
{
|
||||
|
@ -938,7 +938,7 @@ void utp_stream::on_connect(void* self, error_code const& ec, bool kill)
|
|||
, static_cast<void*>(s->m_impl), ec.message().c_str(), kill);
|
||||
|
||||
TORRENT_ASSERT(s->m_connect_handler);
|
||||
s->m_io_service.post(std::bind<void>(s->m_connect_handler, ec));
|
||||
s->m_io_service.post(std::bind<void>(std::move(s->m_connect_handler), ec));
|
||||
s->m_connect_handler = nullptr;
|
||||
if (kill && s->m_impl)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue