diff --git a/src/tracker_manager.cpp b/src/tracker_manager.cpp index a240c57d6..dd2b7fb41 100644 --- a/src/tracker_manager.cpp +++ b/src/tracker_manager.cpp @@ -244,9 +244,10 @@ namespace libtorrent } else { + // we need to post the error to avoid deadlock if (boost::shared_ptr r = c.lock()) - r->tracker_request_error(req, -1, "unknown protocol in tracker url: " - + req.url); + ios.post(boost::bind(&request_callback::tracker_request_error, r, req, -1 + , "unknown protocol in tracker url: " + req.url)); return; } diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index f73eaec8b..85c59d146 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -217,6 +217,7 @@ boost::intrusive_ptr create_torrent(std::ostream* file, int piece_ char const* tracker_url = "http://non-existent-name.com/announce"; // excercise the path when encountering invalid urls char const* invalid_tracker_url = "http:"; + char const* invalid_tracker_protocol = "foo://non/existent-name.com/announce"; using namespace boost::filesystem; @@ -226,6 +227,7 @@ boost::intrusive_ptr create_torrent(std::ostream* file, int piece_ libtorrent::create_torrent t(fs, piece_size); t.add_tracker(tracker_url); t.add_tracker(invalid_tracker_url); + t.add_tracker(invalid_tracker_protocol); std::vector piece(piece_size); for (int i = 0; i < int(piece.size()); ++i)