fix edge case in uTP stream when receiving a close-reason code

This commit is contained in:
arvidn 2016-03-02 22:30:02 -05:00
parent 2e3be6e5ca
commit fbef47d3ec
1 changed files with 5 additions and 2 deletions

View File

@ -923,8 +923,11 @@ int utp_stream::read_buffer_size() const
void utp_stream::on_close_reason(void* self, boost::uint16_t close_reason)
{
utp_stream* s = static_cast<utp_stream*>(self);
TORRENT_ASSERT(s->m_impl);
s->m_incoming_close_reason = close_reason;
// it's possible the socket has been unlinked already, in which case m_impl
// will be NULL
if (s->m_impl)
s->m_incoming_close_reason = close_reason;
}
void utp_stream::on_read(void* self, size_t bytes_transferred