summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-03 04:28:09 +0300
committerKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-03 04:28:09 +0300
commit394e79b27aeae9de83c378b391e5e3cf59ec9759 (patch)
tree0dc1663a05931ea5a717eb99e977198eb746feb2 /segget/distfile.cpp
parentAdd distfiles window to tuiclient. (diff)
downloadidfetch-394e79b27aeae9de83c378b391e5e3cf59ec9759.tar.gz
idfetch-394e79b27aeae9de83c378b391e5e3cf59ec9759.tar.bz2
idfetch-394e79b27aeae9de83c378b391e5e3cf59ec9759.zip
Provide more info on distfiles to tuiclients.
Provide info on distfiles that are already in the list or just added, but not in progress (not started yet or already downloaded) to ui_server/tui_clients.
Diffstat (limited to 'segget/distfile.cpp')
-rw-r--r--segget/distfile.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/segget/distfile.cpp b/segget/distfile.cpp
index d8f8eda..1bc122d 100644
--- a/segget/distfile.cpp
+++ b/segget/distfile.cpp
@@ -25,6 +25,11 @@
*/
#include "distfile.h"
+#include "mirror.h"
+#include "checksum.h"
+#include "network.h"
+#include "segment.h"
+#include "response.h"
//Make the necessary includes and set up the variables:
using namespace std;
@@ -257,6 +262,7 @@ bool Tdistfile::load_distfile_from_json(json_object* json_obj_distfile){
load_url_list(json_object_object_get(json_obj_distfile,"url_list"));
}
debug("Added distfile: "+name+" to download queue");
+ ui_server.send_distfile_progress_msg_to_all_clients(get_distfile_progress_str());
}catch(...){
error_log("Error: distfile.cpp: load_distfile_from_json()");
}
@@ -662,11 +668,21 @@ int Tdistfile::provide_segment(CURLM* cm, uint connection_num, uint seg_num){
return 1;
}
}
+
+string Tdistfile::get_distfile_progress_str(){
+ try{
+ return name+" "+toString(dld_segments_count)+" "+toString(segments_count)+" "+toString(dld_bytes)+" "+toString(size);
+ }catch(...){
+ error_log("Error: distfile.cpp: get_distfile_progress_str()");
+ return "";
+ }
+}
+
void Tdistfile::inc_dld_segments_count(Tsegment* current_segment){
try{
stats.inc_dld_size(current_segment->segment_size);
dld_bytes+=current_segment->segment_size;
- ui_server.send_distfile_progress_msg_to_all_clients(name+" "+toString(dld_segments_count)+" "+toString(segments_count)+" "+toString(dld_bytes)+" "+toString(size));
+ ui_server.send_distfile_progress_msg_to_all_clients(get_distfile_progress_str());
if (++dld_segments_count==segments_count){
combine_segments();
}