summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-08 18:25:41 +0300
committerKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-08 18:25:41 +0300
commit661d296c7cfb76c794f9438dbae72027e8d4a128 (patch)
tree3dd3238d76f26552969e0e7fd0baba3e978d3847 /segget/mirror.cpp
parentReplace img alt=text with <td bgcolor=#XXXXXX> in WebUI. (diff)
downloadidfetch-661d296c7cfb76c794f9438dbae72027e8d4a128.tar.gz
idfetch-661d296c7cfb76c794f9438dbae72027e8d4a128.tar.bz2
idfetch-661d296c7cfb76c794f9438dbae72027e8d4a128.zip
Add statistics to WebUI: general stats, and stats for mirrors.
Diffstat (limited to 'segget/mirror.cpp')
-rw-r--r--segget/mirror.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/segget/mirror.cpp b/segget/mirror.cpp
index 993cb90..5144e9b 100644
--- a/segget/mirror.cpp
+++ b/segget/mirror.cpp
@@ -69,7 +69,12 @@ string convert_to_coral_cdn_url(string url_address){
double Tmirror::mirror_on_the_wall(){
try{
- double criterion=honesty*1000000000*dld_time/dld_size;
+ double criterion;
+ if (dld_size>0){
+ criterion=honesty*1000000000*dld_time/dld_size;
+ }else{
+ criterion=honesty*1000000000*dld_time;
+ }
honesty=honesty*100/(100+settings.benchmark_oblivion);
return criterion;
}catch(...){
@@ -88,8 +93,14 @@ void Tmirror::start(){
}
}
-void Tmirror::stop(ulong time, uint size){
+void Tmirror::stop(ulong time, ulong size){
try{
+ if (size==0){
+ failed_downloads++;
+ }else{
+ successful_downloads++;
+ };
+
dld_time+=time/1000;
dld_size+=size;
honesty=1;