Changeset 3768
- Timestamp:
- 08/28/08 03:56:28 (4 months ago)
- Files:
-
- 8 modified
-
branches/1.0.0_RC/libtorrent/include/libtorrent/magnet_uri.hpp (modified) (1 diff)
-
branches/1.0.0_RC/libtorrent/src/magnet_uri.cpp (modified) (1 diff)
-
branches/1.0.0_RC/libtorrent/src/peer_connection.cpp (modified) (1 diff)
-
branches/1.0.0_RC/libtorrent/src/torrent.cpp (modified) (2 diffs)
-
trunk/libtorrent/include/libtorrent/magnet_uri.hpp (modified) (1 diff)
-
trunk/libtorrent/src/magnet_uri.cpp (modified) (1 diff)
-
trunk/libtorrent/src/peer_connection.cpp (modified) (1 diff)
-
trunk/libtorrent/src/torrent.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0.0_RC/libtorrent/include/libtorrent/magnet_uri.hpp
r3675 r3768 47 47 48 48 std::string TORRENT_EXPORT make_magnet_uri(torrent_handle const& handle); 49 std::string TORRENT_EXPORT make_magnet_uri(torrent_info const& info); 49 50 50 51 #ifndef TORRENT_NO_DEPRECATE -
branches/1.0.0_RC/libtorrent/src/magnet_uri.cpp
r3675 r3768 70 70 } 71 71 72 std::string make_magnet_uri(torrent_info const& info) 73 { 74 std::stringstream ret; 75 if (!info.is_valid()) return ret.str(); 76 77 std::string name = info.name(); 78 79 ret << "magnet:?xt=urn:btih:" << base32encode( 80 std::string((char*)info.info_hash().begin(), 20)); 81 if (!name.empty()) 82 ret << "&dn=" << escape_string(name.c_str(), name.length()); 83 std::vector<announce_entry> const& tr = info.trackers(); 84 if (!tr.empty()) 85 { 86 ret << "&tr=" << escape_string(tr[0].url.c_str() 87 , tr[0].url.length()); 88 } 89 return ret.str(); 90 } 91 72 92 #ifndef TORRENT_NO_DEPRECATE 73 93 torrent_handle add_magnet_uri(session& ses, std::string const& uri -
branches/1.0.0_RC/libtorrent/src/peer_connection.cpp
r3758 r3768 1707 1707 1708 1708 if (t->alerts().should_post<file_error_alert>()) 1709 {1710 1709 t->alerts().post_alert(file_error_alert(j.error_file, t->get_handle(), j.str)); 1711 }1710 t->set_error(j.str); 1712 1711 t->pause(); 1713 1712 return; -
branches/1.0.0_RC/libtorrent/src/torrent.cpp
r3759 r3768 331 331 void torrent::start() 332 332 { 333 // we need to start announcing since we don't have any 334 // metadata. To receive peers to ask for it. 333 335 if (m_torrent_file->is_valid()) init(); 336 else if (!m_trackers.empty()) start_announcing(); 337 334 338 if (m_abort) return; 335 339 } … … 3920 3924 { 3921 3925 if (is_paused()) return; 3922 if (!m_files_checked) return; 3926 // if we don't have metadata, we need to announce 3927 // before checking files, to get peers to 3928 // request the metadata from 3929 if (!m_files_checked && valid_metadata()) return; 3923 3930 if (m_announcing) return; 3924 3931 -
trunk/libtorrent/include/libtorrent/magnet_uri.hpp
r3640 r3768 47 47 48 48 std::string TORRENT_EXPORT make_magnet_uri(torrent_handle const& handle); 49 std::string TORRENT_EXPORT make_magnet_uri(torrent_info const& info); 49 50 50 51 #ifndef TORRENT_NO_DEPRECATE -
trunk/libtorrent/src/magnet_uri.cpp
r3640 r3768 70 70 } 71 71 72 std::string make_magnet_uri(torrent_info const& info) 73 { 74 std::stringstream ret; 75 if (!info.is_valid()) return ret.str(); 76 77 std::string name = info.name(); 78 79 ret << "magnet:?xt=urn:btih:" << base32encode( 80 std::string((char*)info.info_hash().begin(), 20)); 81 if (!name.empty()) 82 ret << "&dn=" << escape_string(name.c_str(), name.length()); 83 std::vector<announce_entry> const& tr = info.trackers(); 84 if (!tr.empty()) 85 { 86 ret << "&tr=" << escape_string(tr[0].url.c_str() 87 , tr[0].url.length()); 88 } 89 return ret.str(); 90 } 91 72 92 #ifndef TORRENT_NO_DEPRECATE 73 93 torrent_handle add_magnet_uri(session& ses, std::string const& uri -
trunk/libtorrent/src/peer_connection.cpp
r3758 r3768 1707 1707 1708 1708 if (t->alerts().should_post<file_error_alert>()) 1709 {1710 1709 t->alerts().post_alert(file_error_alert(j.error_file, t->get_handle(), j.str)); 1711 }1710 t->set_error(j.str); 1712 1711 t->pause(); 1713 1712 return; -
trunk/libtorrent/src/torrent.cpp
r3759 r3768 331 331 void torrent::start() 332 332 { 333 // we need to start announcing since we don't have any 334 // metadata. To receive peers to ask for it. 333 335 if (m_torrent_file->is_valid()) init(); 336 else if (!m_trackers.empty()) start_announcing(); 337 334 338 if (m_abort) return; 335 339 } … … 3920 3924 { 3921 3925 if (is_paused()) return; 3922 if (!m_files_checked) return; 3926 // if we don't have metadata, we need to announce 3927 // before checking files, to get peers to 3928 // request the metadata from 3929 if (!m_files_checked && valid_metadata()) return; 3923 3930 if (m_announcing) return; 3924 3931
