Changeset 1145
- Timestamp:
- 03/15/10 14:31:50 (2 years ago)
- Location:
- trunk
- Files:
-
- 21 modified
-
libtorrent/src/download/download_constructor.cc (modified) (1 diff)
-
libtorrent/src/download/download_main.cc (modified) (1 diff)
-
libtorrent/src/download/download_wrapper.cc (modified) (1 diff)
-
libtorrent/src/protocol/peer_connection_base.cc (modified) (4 diffs)
-
libtorrent/src/torrent/data/transfer_list.h (modified) (1 diff)
-
libtorrent/src/torrent/download.cc (modified) (3 diffs)
-
libtorrent/src/torrent/download.h (modified) (2 diffs)
-
libtorrent/src/torrent/download_info.h (modified) (5 diffs)
-
libtorrent/src/torrent/object.h (modified) (8 diffs)
-
libtorrent/src/torrent/object_raw_bencode.h (modified) (5 diffs)
-
libtorrent/src/torrent/object_stream.cc (modified) (1 diff)
-
libtorrent/src/torrent/resume.cc (modified) (1 diff)
-
rtorrent/src/command_download.cc (modified) (9 diffs)
-
rtorrent/src/command_events.cc (modified) (2 diffs)
-
rtorrent/src/core/download.h (modified) (1 diff)
-
rtorrent/src/core/download_factory.cc (modified) (2 diffs)
-
rtorrent/src/core/download_list.cc (modified) (2 diffs)
-
rtorrent/src/core/download_store.cc (modified) (2 diffs)
-
rtorrent/src/display/utils.cc (modified) (3 diffs)
-
rtorrent/src/main.cc (modified) (2 diffs)
-
rtorrent/src/ui/download.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtorrent/src/download/download_constructor.cc
r1144 r1145 89 89 m_defaultEncoding = b.get_key_string("encoding"); 90 90 91 if (b.has_key_value("creation date")) 92 m_download->info()->set_creation_date(b.get_key_value("creation date")); 93 91 94 m_download->info()->change_flags(DownloadInfo::flag_private, 92 95 b.get_key("info").has_key_value("private") && -
trunk/libtorrent/src/download/download_main.cc
r1144 r1145 78 78 m_metadataSize(0), 79 79 80 m_creationDate(0), 80 81 m_loadDate(rak::timer::current_seconds()) { 81 82 } -
trunk/libtorrent/src/download/download_wrapper.cc
r1144 r1145 335 335 336 336 m_main.connection_list()->erase_seeders(); 337 info()-> down_rate()->reset_rate();338 } 339 340 } 337 info()->mutable_down_rate()->reset_rate(); 338 } 339 340 } -
trunk/libtorrent/src/protocol/peer_connection_base.cc
r1144 r1145 428 428 429 429 m_down->throttle()->node_used(m_peerChunks.download_throttle(), bytesTransfered); 430 m_download->info()-> down_rate()->insert(bytesTransfered);430 m_download->info()->mutable_down_rate()->insert(bytesTransfered); 431 431 432 432 return transfer->is_finished(); … … 498 498 499 499 m_down->throttle()->node_used(m_peerChunks.download_throttle(), length); 500 m_download->info()-> down_rate()->insert(length);500 m_download->info()->mutable_down_rate()->insert(length); 501 501 502 502 return length; … … 517 517 // counted. 518 518 m_down->throttle()->node_used(m_peerChunks.download_throttle(), length); 519 m_download->info()-> down_rate()->insert(length);520 m_download->info()-> skip_rate()->insert(length);519 m_download->info()->mutable_down_rate()->insert(length); 520 m_download->info()->mutable_skip_rate()->insert(length); 521 521 522 522 if (!transfer->is_valid()) { … … 663 663 664 664 m_up->throttle()->node_used(m_peerChunks.upload_throttle(), bytesTransfered); 665 m_download->info()-> up_rate()->insert(bytesTransfered);665 m_download->info()->mutable_up_rate()->insert(bytesTransfered); 666 666 667 667 // Just modifying the piece to cover the remaining data ends up -
trunk/libtorrent/src/torrent/data/transfer_list.h
r1129 r1145 75 75 uint32_t failed_count() const { return m_failedCount; } 76 76 77 // 77 78 // Internal to libTorrent: 79 // 78 80 79 81 void clear(); -
trunk/libtorrent/src/torrent/download.cc
r1144 r1145 189 189 } 190 190 191 // bool192 // Download::is_open() const {193 // return m_ptr->info()->is_open();194 // }195 196 // bool197 // Download::is_active() const {198 // return m_ptr->info()->is_active();199 // }200 201 191 bool 202 192 Download::is_hash_checked() const { … … 209 199 } 210 200 211 // bool212 // Download::is_private() const {213 // return m_ptr->info()->is_private();214 // }215 216 // bool217 // Download::is_pex_active() const {218 // return m_ptr->info()->is_pex_active();219 // }220 221 // bool222 // Download::is_pex_enabled() const {223 // return m_ptr->info()->is_pex_enabled();224 // }225 226 201 void 227 202 Download::set_pex_enabled(bool enabled) { 228 203 m_ptr->info()->change_flags(DownloadInfo::flag_pex_enabled, enabled); 229 }230 231 // bool232 // Download::is_meta_download() const {233 // return m_ptr->info()->is_meta_download();234 // }235 236 const std::string&237 Download::name() const {238 if (m_ptr == NULL)239 throw internal_error("Download::name() m_ptr == NULL.");240 241 return m_ptr->info()->name();242 }243 244 const HashString&245 Download::info_hash() const {246 return m_ptr->info()->hash();247 }248 249 const HashString&250 Download::info_hash_obfuscated() const {251 return m_ptr->info()->hash_obfuscated();252 }253 254 const HashString&255 Download::local_id() const {256 return m_ptr->info()->local_id();257 }258 259 uint32_t260 Download::creation_date() const {261 if (m_ptr->bencode()->has_key_value("creation date"))262 return m_ptr->bencode()->get_key_value("creation date");263 else264 return 0;265 }266 267 uint32_t268 Download::load_date() const {269 return m_ptr->info()->load_date();270 204 } 271 205 … … 313 247 Download::connection_list() const { 314 248 return m_ptr->main()->connection_list(); 315 }316 317 Rate*318 Download::down_rate() {319 return m_ptr->info()->down_rate();320 }321 322 const Rate*323 Download::down_rate() const {324 return m_ptr->info()->down_rate();325 }326 327 Rate*328 Download::mutable_down_rate() {329 return m_ptr->info()->down_rate();330 }331 332 Rate*333 Download::up_rate() {334 return m_ptr->info()->up_rate();335 }336 337 const Rate*338 Download::up_rate() const {339 return m_ptr->info()->up_rate();340 }341 342 Rate*343 Download::mutable_up_rate() {344 return m_ptr->info()->up_rate();345 }346 347 Rate*348 Download::skip_rate() {349 return m_ptr->info()->skip_rate();350 }351 352 const Rate*353 Download::skip_rate() const {354 return m_ptr->info()->skip_rate();355 }356 357 Rate*358 Download::mutable_skip_rate() {359 return m_ptr->info()->skip_rate();360 249 } 361 250 -
trunk/libtorrent/src/torrent/download.h
r1144 r1145 93 93 bool is_valid() const { return m_ptr; } 94 94 95 // bool is_open() const;96 // bool is_active() const;97 98 95 bool is_hash_checked() const; 99 96 bool is_hash_checking() const; 100 97 101 // bool is_private() const;102 // bool is_pex_active() const;103 // bool is_pex_enabled() const;104 98 void set_pex_enabled(bool enabled); 105 106 // bool is_meta_download() const;107 108 // Returns "" if the object is not valid.109 const std::string& name() const;110 111 const HashString& info_hash() const;112 const HashString& info_hash_obfuscated() const;113 const HashString& local_id() const;114 115 // Unix epoche, 0 == unknown.116 uint32_t creation_date() const;117 uint32_t load_date() const;118 99 119 100 Object* bencode(); … … 129 110 ConnectionList* connection_list(); 130 111 const ConnectionList* connection_list() const; 131 132 // Remove the old non-const versions.133 Rate* down_rate();134 const Rate* down_rate() const;135 Rate* mutable_down_rate();136 137 Rate* up_rate();138 const Rate* up_rate() const;139 Rate* mutable_up_rate();140 141 Rate* skip_rate();142 const Rate* skip_rate() const;143 Rate* mutable_skip_rate();144 112 145 113 // Bytes completed. -
trunk/libtorrent/src/torrent/download_info.h
r1144 r1145 107 107 void set_pex_enabled() { if (!is_private()) set_flags(flag_pex_enabled); } 108 108 109 Rate* up_rate() { return &m_upRate; } 110 Rate* down_rate() { return &m_downRate; } 111 Rate* skip_rate() { return &m_skipRate; } 109 const Rate* up_rate() const { return &m_upRate; } 110 const Rate* down_rate() const { return &m_downRate; } 111 const Rate* skip_rate() const { return &m_skipRate; } 112 113 Rate* mutable_up_rate() const { return &m_upRate; } 114 Rate* mutable_down_rate() const { return &m_downRate; } 115 Rate* mutable_skip_rate() const { return &m_skipRate; } 112 116 113 117 uint64_t uploaded_baseline() const { return m_uploadedBaseline; } … … 130 134 uint32_t max_size_pex_list() const { return 200; } 131 135 136 // Unix epoche, 0 == unknown. 137 uint32_t creation_date() const { return m_creationDate; } 132 138 uint32_t load_date() const { return m_loadDate; } 133 139 … … 143 149 signal_dump_type& signal_tracker_dump() { return m_signalTrackerDump; } 144 150 151 // 152 // Libtorrent internal: 153 // 154 155 void set_creation_date(uint32_t d) { m_creationDate = d; } 156 145 157 private: 146 158 std::string m_name; … … 151 163 int m_flags; 152 164 153 Ratem_upRate;154 Ratem_downRate;155 Ratem_skipRate;165 mutable Rate m_upRate; 166 mutable Rate m_downRate; 167 mutable Rate m_skipRate; 156 168 157 169 uint64_t m_uploadedBaseline; … … 161 173 size_t m_metadataSize; 162 174 175 uint32_t m_creationDate; 163 176 uint32_t m_loadDate; 164 177 -
trunk/libtorrent/src/torrent/object.h
r1138 r1145 82 82 TYPE_NONE, 83 83 TYPE_RAW_BENCODE, 84 TYPE_RAW_VALUE,85 84 TYPE_RAW_STRING, 86 85 TYPE_RAW_LIST, … … 97 96 Object(const string_type& s) : m_flags(TYPE_STRING) { new (&_string()) string_type(s); } 98 97 Object(const raw_bencode& r) : m_flags(TYPE_RAW_BENCODE) { new (&_raw_bencode()) raw_bencode(r); } 99 Object(const raw_value& r) : m_flags(TYPE_RAW_VALUE) { new (&_raw_value()) raw_value(r); }100 98 Object(const raw_string& r) : m_flags(TYPE_RAW_STRING) { new (&_raw_string()) raw_string(r); } 101 99 Object(const raw_list& r) : m_flags(TYPE_RAW_LIST) { new (&_raw_list()) raw_list(r); } … … 115 113 static Object create_raw_bencode(raw_bencode obj = raw_bencode()) { 116 114 Object tmp; tmp.m_flags = TYPE_RAW_BENCODE; new (&tmp._raw_bencode()) raw_bencode(); return tmp; 117 }118 static Object create_raw_value(raw_value obj = raw_value()) {119 Object tmp; tmp.m_flags = TYPE_RAW_VALUE; new (&tmp._raw_value()) raw_value(); return tmp;120 115 } 121 116 static Object create_raw_string(raw_string obj = raw_string()) { … … 165 160 raw_bencode& as_raw_bencode() { check_throw(TYPE_RAW_BENCODE); return _raw_bencode(); } 166 161 const raw_bencode& as_raw_bencode() const { check_throw(TYPE_RAW_BENCODE); return _raw_bencode(); } 167 raw_value& as_raw_value() { check_throw(TYPE_RAW_VALUE); return _raw_value(); }168 const raw_value& as_raw_value() const { check_throw(TYPE_RAW_VALUE); return _raw_value(); }169 162 raw_string& as_raw_string() { check_throw(TYPE_RAW_STRING); return _raw_string(); } 170 163 const raw_string& as_raw_string() const { check_throw(TYPE_RAW_STRING); return _raw_string(); } … … 180 173 bool has_key_map(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_MAP); } 181 174 bool has_key_raw_bencode(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_BENCODE); } 182 bool has_key_raw_value(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_VALUE); }183 175 bool has_key_raw_string(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_STRING); } 184 176 bool has_key_raw_list(const key_type& k) const { check_throw(TYPE_MAP); return check(_map().find(k), TYPE_RAW_LIST); } … … 258 250 raw_bencode& _raw_bencode() { return reinterpret_cast<raw_bencode&>(t_pod); } 259 251 const raw_bencode& _raw_bencode() const { return reinterpret_cast<const raw_bencode&>(t_pod); } 260 raw_value& _raw_value() { return reinterpret_cast<raw_value&>(t_pod); }261 const raw_value& _raw_value() const { return reinterpret_cast<const raw_value&>(t_pod); }262 252 raw_string& _raw_string() { return reinterpret_cast<raw_string&>(t_pod); } 263 253 const raw_string& _raw_string() const { return reinterpret_cast<const raw_string&>(t_pod); } … … 287 277 case TYPE_NONE: 288 278 case TYPE_RAW_BENCODE: 289 case TYPE_RAW_VALUE:290 279 case TYPE_RAW_STRING: 291 280 case TYPE_RAW_LIST: … … 302 291 switch (t) { 303 292 case TYPE_RAW_BENCODE: return create_raw_bencode(); 304 case TYPE_RAW_VALUE: return create_raw_value();305 293 case TYPE_RAW_STRING: return create_raw_string(); 306 294 case TYPE_RAW_LIST: return create_raw_list(); -
trunk/libtorrent/src/torrent/object_raw_bencode.h
r1141 r1145 46 46 47 47 class raw_bencode; 48 class raw_value;49 48 class raw_string; 50 49 class raw_list; … … 104 103 105 104 bool is_empty() const { return m_size == 0; } 106 bool is_ raw_value() const{ return m_size && m_data[0] >= 'i'; }105 bool is_value() const { return m_size && m_data[0] >= 'i'; } 107 106 bool is_raw_string() const { return m_size && m_data[0] >= '0' && m_data[0] <= '9'; } 108 107 bool is_raw_list() const { return m_size && m_data[0] >= 'l'; } 109 108 bool is_raw_map() const { return m_size && m_data[0] >= 'd'; } 110 109 111 raw_value as_raw_value() const;112 110 raw_string as_raw_string() const; 113 111 raw_list as_raw_list() const; … … 117 115 }; 118 116 119 class raw_value : protected raw_object {120 public:121 typedef raw_value this_type;122 RAW_BENCODE_SET_USING123 124 raw_value() {}125 raw_value(value_type* src_data, size_type src_size) : raw_object(src_data, src_size) {}126 127 // int64_t as_value() const;128 };129 130 117 class raw_string : protected raw_object { 131 118 public: … … 164 151 // 165 152 // 166 167 inline raw_value168 raw_bencode::as_raw_value() const {169 if (!is_raw_value())170 throw bencode_error("Wrong object type.");171 172 return raw_value(m_data + 1, m_size - 2);173 }174 153 175 154 inline raw_string … … 202 181 } 203 182 204 // inline int64_t205 // raw_value::as_value() const {206 // int64_t value = strtoll(207 // }208 209 210 183 // 211 184 // Redo... -
trunk/libtorrent/src/torrent/object_stream.cc
r1144 r1145 500 500 break; 501 501 } 502 case Object::TYPE_RAW_VALUE:503 {504 raw_value raw = object->as_raw_value();505 object_write_bencode_c_char(output, 'i');506 object_write_bencode_c_string(output, raw.begin(), raw.size());507 object_write_bencode_c_char(output, 'e');508 break;509 }510 502 case Object::TYPE_RAW_STRING: 511 503 { -
trunk/libtorrent/src/torrent/resume.cc
r1144 r1145 265 265 if (!object.has_key_string("uncertain_pieces") || 266 266 !object.has_key_value("uncertain_pieces.timestamp") || 267 object.get_key_value("uncertain_pieces.timestamp") >= (int64_t)download. load_date())267 object.get_key_value("uncertain_pieces.timestamp") >= (int64_t)download.info()->load_date()) 268 268 return; 269 269 -
trunk/rtorrent/src/command_download.cc
r1144 r1145 108 108 109 109 if (type == "base_path") { 110 target = rpc::call_command_string("d. get_base_path", rpc::make_target(download));111 link = rak::path_expand(prefix + rpc::call_command_string("d. get_base_path", rpc::make_target(download)) + postfix);110 target = rpc::call_command_string("d.base_path", rpc::make_target(download)); 111 link = rak::path_expand(prefix + rpc::call_command_string("d.base_path", rpc::make_target(download)) + postfix); 112 112 113 113 } else if (type == "base_filename") { 114 target = rpc::call_command_string("d. get_base_path", rpc::make_target(download));114 target = rpc::call_command_string("d.base_path", rpc::make_target(download)); 115 115 link = rak::path_expand(prefix + rpc::call_command_string("d.get_base_filename", rpc::make_target(download)) + postfix); 116 116 117 117 // } else if (type == "directory_path") { 118 118 // target = rpc::call_command_string("d.get_directory", rpc::make_target(download)); 119 // link = rak::path_expand(prefix + rpc::call_command_string("d. get_base_path", rpc::make_target(download)) + postfix);119 // link = rak::path_expand(prefix + rpc::call_command_string("d.base_path", rpc::make_target(download)) + postfix); 120 120 121 121 } else if (type == "tied") { … … 126 126 127 127 link = rak::path_expand(prefix + link + postfix); 128 target = rpc::call_command_string("d. get_base_path", rpc::make_target(download));128 target = rpc::call_command_string("d.base_path", rpc::make_target(download)); 129 129 130 130 } else { … … 192 192 download->set_root_directory(name); 193 193 else if (name.empty() || *name.rbegin() == '/') 194 download->set_root_directory(name + download-> download()->name());194 download->set_root_directory(name + download->info()->name()); 195 195 else 196 download->set_root_directory(name + "/" + download-> download()->name());196 download->set_root_directory(name + "/" + download->info()->name()); 197 197 } 198 198 … … 233 233 234 234 int64_t bytesDone = download->download()->bytes_done(); 235 int64_t upTotal = download-> download()->up_rate()->total();235 int64_t upTotal = download->info()->up_rate()->total(); 236 236 237 237 return bytesDone > 0 ? (1000 * upTotal) / bytesDone : 0; … … 240 240 torrent::Object 241 241 retrieve_d_hash(core::Download* download) { 242 const torrent::HashString* hashString = &download-> download()->info_hash();242 const torrent::HashString* hashString = &download->info()->hash(); 243 243 244 244 return torrent::Object(rak::transform_hex(hashString->begin(), hashString->end())); … … 247 247 torrent::Object 248 248 retrieve_d_local_id(core::Download* download) { 249 const torrent::HashString* hashString = &download-> download()->local_id();249 const torrent::HashString* hashString = &download->info()->local_id(); 250 250 251 251 return torrent::Object(rak::transform_hex(hashString->begin(), hashString->end())); … … 254 254 torrent::Object 255 255 retrieve_d_local_id_html(core::Download* download) { 256 const torrent::HashString* hashString = &download-> download()->local_id();256 const torrent::HashString* hashString = &download->info()->local_id(); 257 257 258 258 return torrent::Object(rak::copy_escape_html(hashString->begin(), hashString->end())); … … 563 563 } 564 564 565 #define CMD_ON_INFO(func) \ 566 rak::on(std::mem_fun(&core::Download::info), std::mem_fun(&torrent::DownloadInfo::func)) 567 565 568 void 566 569 initialize_command_download() { 567 ADD_CD_VOID("hash", &retrieve_d_hash); 568 ADD_CD_VOID("local_id", &retrieve_d_local_id); 569 ADD_CD_VOID("local_id_html", &retrieve_d_local_id_html); 570 ADD_CD_VOID("bitfield", &retrieve_d_bitfield); 571 ADD_CD_VOID("base_path", &retrieve_d_base_path); 572 ADD_CD_VOID("base_filename", &retrieve_d_base_filename); 573 ADD_CD_STRING_UNI("name", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::name))); 570 CMD_D_VOID("d.hash", &retrieve_d_hash); 571 CMD_D_VOID("d.local_id", &retrieve_d_local_id); 572 CMD_D_VOID("d.local_id_html", &retrieve_d_local_id_html); 573 CMD_D_VOID("d.bitfield", &retrieve_d_bitfield); 574 CMD_D_VOID("d.base_path", &retrieve_d_base_path); 575 CMD_D_VOID("d.base_filename", &retrieve_d_base_filename); 576 577 CMD_D_VOID_SLOT("d.name", CMD_ON_INFO(name)); 578 579 CMD_D_VOID_SLOT("d.creation_date", CMD_ON_INFO(creation_date)); 580 CMD_D_VOID_SLOT("d.load_date", CMD_ON_INFO(load_date)); 574 581 575 582 // ????? … … 677 684 ADD_CD_VALUE_UNI("peers_accounted", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::peers_accounted))); 678 685 679 ADD_CD_VALUE_MEM_UNI("up_rate", &torrent::Download::mutable_up_rate, &torrent::Rate::rate); 680 ADD_CD_VALUE_MEM_UNI("up_total", &torrent::Download::mutable_up_rate, &torrent::Rate::total); 681 ADD_CD_VALUE_MEM_UNI("down_rate", &torrent::Download::mutable_down_rate, &torrent::Rate::rate); 682 ADD_CD_VALUE_MEM_UNI("down_total", &torrent::Download::mutable_down_rate, &torrent::Rate::total); 683 ADD_CD_VALUE_MEM_UNI("skip_rate", &torrent::Download::mutable_skip_rate, &torrent::Rate::rate); 684 ADD_CD_VALUE_MEM_UNI("skip_total", &torrent::Download::mutable_skip_rate, &torrent::Rate::total); 686 // 687 CMD_D_VOID_SLOT("d.up.rate", rak::on(CMD_ON_INFO(up_rate), std::mem_fun(&torrent::Rate::rate))); 688 CMD_D_VOID_SLOT("d.up.total", rak::on(CMD_ON_INFO(up_rate), std::mem_fun(&torrent::Rate::total))); 689 CMD_D_VOID_SLOT("d.down.rate", rak::on(CMD_ON_INFO(down_rate), std::mem_fun(&torrent::Rate::rate))); 690 CMD_D_VOID_SLOT("d.down.total", rak::on(CMD_ON_INFO(down_rate), std::mem_fun(&torrent::Rate::total))); 691 CMD_D_VOID_SLOT("d.skip.rate", rak::on(CMD_ON_INFO(skip_rate), std::mem_fun(&torrent::Rate::rate))); 692 CMD_D_VOID_SLOT("d.skip.total", rak::on(CMD_ON_INFO(skip_rate), std::mem_fun(&torrent::Rate::total))); 693 // 685 694 686 695 ADD_CD_STRING("set_throttle_name", std::mem_fun(&core::Download::set_throttle_name)); 687 696 ADD_CD_SLOT_PUBLIC("d.get_throttle_name", call_unknown, rpc::get_variable_d_fn("rtorrent", "throttle_name"), "i:", ""); 688 697 689 ADD_CD_VALUE_UNI("creation_date", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::creation_date)));690 698 ADD_CD_VALUE_UNI("bytes_done", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::bytes_done))); 691 699 ADD_CD_VALUE_UNI("ratio", std::ptr_fun(&retrieve_d_ratio)); -
trunk/rtorrent/src/command_events.cc
r1139 r1145 95 95 96 96 int64_t totalDone = (*itr)->download()->bytes_done(); 97 int64_t totalUpload = (*itr)-> download()->up_rate()->total();97 int64_t totalUpload = (*itr)->info()->up_rate()->total(); 98 98 99 99 if (!(totalUpload >= minUpload && totalUpload * 100 >= totalDone * minRatio) && … … 265 265 266 266 for (core::View::const_iterator itr = (*viewItr)->begin_visible(), last = (*viewItr)->end_visible(); itr != last; itr++) { 267 const torrent::HashString* hashString = &(*itr)-> download()->info_hash();267 const torrent::HashString* hashString = &(*itr)->info()->hash(); 268 268 269 269 resultList.push_back(rak::transform_hex(hashString->begin(), hashString->end())); -
trunk/rtorrent/src/core/download.h
r1144 r1145 153 153 inline bool 154 154 Download::operator == (const std::string& str) const { 155 return str.size() == torrent::HashString::size_data && *torrent::HashString::cast_from(str) == m_download.info _hash();155 return str.size() == torrent::HashString::size_data && *torrent::HashString::cast_from(str) == m_download.info()->hash(); 156 156 } 157 157 -
trunk/rtorrent/src/core/download_factory.cc
r1144 r1145 305 305 306 306 // Save the info-hash just in case the commands decide to delete it. 307 torrent::HashString infohash = download-> download()->info_hash();307 torrent::HashString infohash = download->info()->hash(); 308 308 309 309 try { … … 383 383 384 384 if (rtorrent->has_key_value("total_uploaded")) 385 download-> download()->up_rate()->set_total(rtorrent->get_key_value("total_uploaded"));385 download->info()->mutable_up_rate()->set_total(rtorrent->get_key_value("total_uploaded")); 386 386 387 387 if (rtorrent->has_key_value("chunks_done")) -
trunk/rtorrent/src/core/download_list.cc
r1144 r1145 95 95 DownloadList::iterator 96 96 DownloadList::find(const torrent::HashString& hash) { 97 return std::find_if(begin(), end(), rak::equal(hash, rak::on(std::mem_fun(&Download:: download), std::mem_fun(&torrent::Download::info_hash))));97 return std::find_if(begin(), end(), rak::equal(hash, rak::on(std::mem_fun(&Download::info), std::mem_fun(&torrent::DownloadInfo::hash)))); 98 98 } 99 99 … … 105 105 *itr = (rak::hexchar_to_value(*hash) << 4) + rak::hexchar_to_value(*(hash + 1)); 106 106 107 return std::find_if(begin(), end(), rak::equal(key, rak::on(std::mem_fun(&Download:: download), std::mem_fun(&torrent::Download::info_hash))));107 return std::find_if(begin(), end(), rak::equal(key, rak::on(std::mem_fun(&Download::info), std::mem_fun(&torrent::DownloadInfo::hash)))); 108 108 } 109 109 -
trunk/rtorrent/src/core/download_store.cc
r1126 r1145 139 139 // Move this somewhere else? 140 140 rtorrent_base->insert_key("chunks_done", d->download()->file_list()->completed_chunks()); 141 rtorrent_base->insert_key("total_uploaded", d-> download()->up_rate()->total());141 rtorrent_base->insert_key("total_uploaded", d->info()->up_rate()->total()); 142 142 143 143 // Don't save for completed torrents when we've cleared the uncertain_pieces. … … 215 215 std::string 216 216 DownloadStore::create_filename(Download* d) { 217 return m_path + rak::transform_hex(d-> download()->info_hash().begin(), d->download()->info_hash().end()) + ".torrent";218 } 219 220 } 217 return m_path + rak::transform_hex(d->info()->hash().begin(), d->info()->hash().end()) + ".torrent"; 218 } 219 220 } -
trunk/rtorrent/src/display/utils.cc
r1144 r1145 128 128 char* 129 129 print_download_title(char* first, char* last, core::Download* d) { 130 return print_buffer(first, last, " %s", d-> download()->name().c_str());130 return print_buffer(first, last, " %s", d->info()->name().c_str()); 131 131 } 132 132 … … 148 148 149 149 first = print_buffer(first, last, " Rate: %5.1f / %5.1f KB Uploaded: %7.1f MB", 150 (double)d-> download()->up_rate()->rate() / (1 << 10),151 (double)d-> download()->down_rate()->rate() / (1 << 10),152 (double)d-> download()->up_rate()->total() / (1 << 20));150 (double)d->info()->up_rate()->rate() / (1 << 10), 151 (double)d->info()->down_rate()->rate() / (1 << 10), 152 (double)d->info()->up_rate()->total() / (1 << 20)); 153 153 154 154 if (d->download()->info()->is_active() && !d->is_done()) { … … 217 217 char* 218 218 print_download_time_left(char* first, char* last, core::Download* d) { 219 uint32_t rate = d-> download()->down_rate()->rate();219 uint32_t rate = d->info()->down_rate()->rate(); 220 220 221 221 if (rate < 512) -
trunk/rtorrent/src/main.cc
r1144 r1145 250 250 251 251 "view_add = name\n" 252 "view_sort_new = name,less=d. get_name=\n"253 "view_sort_current = name,less=d. get_name=\n"252 "view_sort_new = name,less=d.name=\n" 253 "view_sort_current = name,less=d.name=\n" 254 254 255 255 "view_add = active\n" … … 352 352 "method.insert = set_max_memory_usage,redirect|const,pieces.memory.max.set\n" 353 353 354 "method.insert = d.get_hash,redirect|const,d.hash\n" 355 "method.insert = d.get_local_id,redirect|const,d.local_id\n" 356 "method.insert = d.get_local_id_html,redirect|const,d.local_id_html\n" 357 "method.insert = d.get_bitfield,redirect|const,d.bitfield\n" 358 "method.insert = d.get_base_path,redirect|const,d.base_path\n" 359 360 "method.insert = d.get_name,redirect|const,d.name\n" 361 "method.insert = d.get_creation_date,redirect|const,d.creation_date\n" 362 354 363 "method.insert = d.get_peer_exchange,redirect|const,d.peer_exchange\n" 364 365 "method.insert = d.get_up_rate,redirect|const,d.up.rate\n" 366 "method.insert = d.get_up_total,redirect|const,d.up.total\n" 367 "method.insert = d.get_down_rate,redirect|const,d.down.rate\n" 368 "method.insert = d.get_down_total,redirect|const,d.down.total\n" 369 "method.insert = d.get_skip_rate,redirect|const,d.skip.rate\n" 370 "method.insert = d.get_skip_total,redirect|const,d.skip.total\n" 355 371 ); 356 372 -
trunk/rtorrent/src/ui/download.cc
r1144 r1145 150 150 // Get these bindings with some kind of string map. 151 151 152 element->push_column("Name:", te_command("d. get_name="));153 element->push_column("Local id:", te_command("d. get_local_id_html="));154 element->push_column("Info hash:", te_command("d. get_hash="));155 element->push_column("Created:", te_command("cat=$to_date=$d. get_creation_date=,\" \",$to_time=$d.get_creation_date="));152 element->push_column("Name:", te_command("d.name=")); 153 element->push_column("Local id:", te_command("d.local_id_html=")); 154 element->push_column("Info hash:", te_command("d.hash=")); 155 element->push_column("Created:", te_command("cat=$to_date=$d.creation_date=,\" \",$to_time=$d.creation_date=")); 156 156 157 157 element->push_back(""); 158 158 element->push_column("Directory:", te_command("d.get_directory=")); 159 element->push_column("Base Path:", te_command("d. get_base_path="));159 element->push_column("Base Path:", te_command("d.base_path=")); 160 160 element->push_column("Tied to file:", te_command("d.get_tied_to_file=")); 161 161 element->push_column("File stats:", te_command("cat=$if=$d.is_multi_file=\\,multi\\,single,\" \",$d.get_size_files=,\" files\"")); … … 192 192 193 193 element->push_back(""); 194 element->push_column("Upload:", te_command("cat=$to_kb=$d. get_up_rate=,\" KB / \",$to_xb=$d.get_up_total="));195 element->push_column("Download:", te_command("cat=$to_kb=$d. get_down_rate=,\" KB / \",$to_xb=$d.get_down_total="));196 element->push_column("Skipped:", te_command("cat=$to_kb=$d. get_skip_rate=,\" KB / \",$to_xb=$d.get_skip_total="));194 element->push_column("Upload:", te_command("cat=$to_kb=$d.up.rate=,\" KB / \",$to_xb=$d.up.total=")); 195 element->push_column("Download:", te_command("cat=$to_kb=$d.down.rate=,\" KB / \",$to_xb=$d.down.total=")); 196 element->push_column("Skipped:", te_command("cat=$to_kb=$d.skip.rate=,\" KB / \",$to_xb=$d.skip.total=")); 197 197 element->push_column("Preload:", te_command("cat=$pieces.preload.type=,\" / \",$pieces.stats_preloaded=,\" / \",$pieces.stats_preloaded=")); 198 198 … … 290 290 switch (displayType) { 291 291 case DISPLAY_MAX_SIZE: break; 292 default: control->ui()->window_title()->set_title(m_download-> download()->name()); break;292 default: control->ui()->window_title()->set_title(m_download->info()->name()); break; 293 293 } 294 294
