From 661d296c7cfb76c794f9438dbae72027e8d4a128 Mon Sep 17 00:00:00 2001 From: Kostyantyn Ovechko Date: Sun, 8 Aug 2010 18:25:41 +0300 Subject: Add statistics to WebUI: general stats, and stats for mirrors. --- segget/mirror.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'segget/mirror.cpp') 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; -- cgit v1.2.3-65-gdbad