forked from premiere/premiere-libtorrent
fix issue with SSL tracker connections left in CLOSE_WAIT state (#2797)
This commit is contained in:
parent
0ecb935d9d
commit
eec34e3ac3
|
@ -1,4 +1,5 @@
|
|||
|
||||
* fix issue with SSL tracker connections left in CLOSE_WAIT state
|
||||
* defer truncating existing files until the first time we write to them
|
||||
* fix issue when receiving a torrent with 0-sized padfiles as magnet link
|
||||
* fix issue resuming 1.0.x downloads with a file priority 0
|
||||
|
|
|
@ -139,6 +139,8 @@ namespace libtorrent
|
|||
#ifdef TORRENT_USE_OPENSSL
|
||||
namespace {
|
||||
|
||||
void nop(boost::shared_ptr<void>) {}
|
||||
|
||||
void on_close_socket(socket_type* s, boost::shared_ptr<void>)
|
||||
{
|
||||
#if defined TORRENT_ASIO_DEBUGGING
|
||||
|
@ -165,9 +167,16 @@ namespace libtorrent
|
|||
#define MAYBE_ASIO_DEBUGGING
|
||||
#endif
|
||||
|
||||
char const buffer[] = "";
|
||||
// chasing the async_shutdown by a write is a trick to close the socket as
|
||||
// soon as we've sent the close_notify, without having to wait to receive a
|
||||
// response from the other end
|
||||
// https://stackoverflow.com/questions/32046034/what-is-the-proper-way-to-securely-disconnect-an-asio-ssl-socket
|
||||
|
||||
#define CASE(t) case socket_type_int_impl<ssl_stream<t> >::value: \
|
||||
MAYBE_ASIO_DEBUGGING \
|
||||
s.get<ssl_stream<t> >()->async_shutdown(boost::bind(&on_close_socket, &s, holder)); \
|
||||
s.get<ssl_stream<t> >()->async_shutdown(boost::bind(&nop, holder)); \
|
||||
s.get<ssl_stream<t> >()->async_write_some(boost::asio::buffer(buffer), boost::bind(&on_close_socket, &s, holder)); \
|
||||
break;
|
||||
|
||||
switch (s.type())
|
||||
|
|
Loading…
Reference in New Issue