forked from premiere/premiere-libtorrent
fixed race condition in udp_tracker_connection
This commit is contained in:
parent
599cfe3820
commit
db426ae80d
|
@ -1,3 +1,5 @@
|
||||||
|
* fixed a race condition bug in udp_tracker_connection that could
|
||||||
|
cause a crash.
|
||||||
* fixed bug occuring when increasing the sequenced download threshold
|
* fixed bug occuring when increasing the sequenced download threshold
|
||||||
with max availability lower than previous threshold.
|
with max availability lower than previous threshold.
|
||||||
* fixed an integer overflow bug occuring when built with gcc 4.1.x
|
* fixed an integer overflow bug occuring when built with gcc 4.1.x
|
||||||
|
|
|
@ -101,6 +101,7 @@ namespace libtorrent
|
||||||
, tcp::resolver::iterator i) try
|
, tcp::resolver::iterator i) try
|
||||||
{
|
{
|
||||||
if (error == asio::error::operation_aborted) return;
|
if (error == asio::error::operation_aborted) return;
|
||||||
|
if (!m_socket) return; // the operation was aborted
|
||||||
if (error || i == tcp::resolver::iterator())
|
if (error || i == tcp::resolver::iterator())
|
||||||
{
|
{
|
||||||
fail(-1, error.what());
|
fail(-1, error.what());
|
||||||
|
@ -138,6 +139,7 @@ namespace libtorrent
|
||||||
+ lexical_cast<std::string>(tracker_req().info_hash) + "]");
|
+ lexical_cast<std::string>(tracker_req().info_hash) + "]");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!m_socket) return; // the operation was aborted
|
||||||
|
|
||||||
char send_buf[16];
|
char send_buf[16];
|
||||||
char* ptr = send_buf;
|
char* ptr = send_buf;
|
||||||
|
@ -164,6 +166,7 @@ namespace libtorrent
|
||||||
, std::size_t bytes_transferred) try
|
, std::size_t bytes_transferred) try
|
||||||
{
|
{
|
||||||
if (error == asio::error::operation_aborted) return;
|
if (error == asio::error::operation_aborted) return;
|
||||||
|
if (!m_socket) return; // the operation was aborted
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
fail(-1, error.what());
|
fail(-1, error.what());
|
||||||
|
@ -248,6 +251,8 @@ namespace libtorrent
|
||||||
if (m_transaction_id == 0)
|
if (m_transaction_id == 0)
|
||||||
m_transaction_id = rand() ^ (rand() << 16);
|
m_transaction_id = rand() ^ (rand() << 16);
|
||||||
|
|
||||||
|
if (!m_socket) return; // the operation was aborted
|
||||||
|
|
||||||
std::vector<char> buf;
|
std::vector<char> buf;
|
||||||
std::back_insert_iterator<std::vector<char> > out(buf);
|
std::back_insert_iterator<std::vector<char> > out(buf);
|
||||||
|
|
||||||
|
@ -302,6 +307,8 @@ namespace libtorrent
|
||||||
if (m_transaction_id == 0)
|
if (m_transaction_id == 0)
|
||||||
m_transaction_id = rand() ^ (rand() << 16);
|
m_transaction_id = rand() ^ (rand() << 16);
|
||||||
|
|
||||||
|
if (!m_socket) return; // the operation was aborted
|
||||||
|
|
||||||
std::vector<char> buf;
|
std::vector<char> buf;
|
||||||
std::back_insert_iterator<std::vector<char> > out(buf);
|
std::back_insert_iterator<std::vector<char> > out(buf);
|
||||||
|
|
||||||
|
@ -325,6 +332,7 @@ namespace libtorrent
|
||||||
, std::size_t bytes_transferred) try
|
, std::size_t bytes_transferred) try
|
||||||
{
|
{
|
||||||
if (error == asio::error::operation_aborted) return;
|
if (error == asio::error::operation_aborted) return;
|
||||||
|
if (!m_socket) return; // the operation was aborted
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
fail(-1, error.what());
|
fail(-1, error.what());
|
||||||
|
@ -433,6 +441,7 @@ namespace libtorrent
|
||||||
, std::size_t bytes_transferred) try
|
, std::size_t bytes_transferred) try
|
||||||
{
|
{
|
||||||
if (error == asio::error::operation_aborted) return;
|
if (error == asio::error::operation_aborted) return;
|
||||||
|
if (!m_socket) return; // the operation was aborted
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
fail(-1, error.what());
|
fail(-1, error.what());
|
||||||
|
|
Loading…
Reference in New Issue