From 8b1b8cb5078d78856a4ea2a53d2cf86b202c851b Mon Sep 17 00:00:00 2001 From: Kostyantyn Ovechko Date: Wed, 28 Jul 2010 00:59:38 +0300 Subject: Add CoralCDN support Add option to network#.conf files: [mode] --- segget/connection.cpp | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'segget/connection.cpp') diff --git a/segget/connection.cpp b/segget/connection.cpp index a9d438e..ec05269 100644 --- a/segget/connection.cpp +++ b/segget/connection.cpp @@ -56,12 +56,21 @@ void Tconnection::start(CURLM *cm, uint network_number, uint distfile_num, Tsegm Tmirror *Pcurr_mirror; string url; - if (network_array[network_num].network_mode==MODE_REMOTE){ - url=segment->parent_distfile->url_list[mirror_num]; - Pcurr_mirror=find_mirror(strip_mirror_name(url)); - }else{ - Pcurr_mirror=&network_array[network_num].benchmarked_mirror_list[mirror_num]; - url=Pcurr_mirror->url+segment->parent_distfile->name; + switch (network_array[network_num].network_mode){ + case MODE_REMOTE:{ + url=segment->parent_distfile->url_list[mirror_num]; + Pcurr_mirror=find_mirror(strip_mirror_name(url)); + break; + } + case MODE_CORAL_CDN:{ + url=convert_to_coral_cdn_url(segment->parent_distfile->url_list[mirror_num]); + Pcurr_mirror=find_mirror(strip_mirror_name(url)); + break; + } + default:{ + Pcurr_mirror=&network_array[network_num].benchmarked_mirror_list[mirror_num]; + url=Pcurr_mirror->url+segment->parent_distfile->name; + } } debug(" URL:"+url); @@ -123,10 +132,15 @@ void Tconnection::stop(CURLcode connection_result){ */ Tmirror *Pcurr_mirror; - if (network_array[network_num].network_mode==MODE_REMOTE){ - Pcurr_mirror=find_mirror(strip_mirror_name(segment->url)); - }else{ - Pcurr_mirror=&network_array[network_num].benchmarked_mirror_list[mirror_num]; + switch (network_array[network_num].network_mode){ + case MODE_REMOTE: + case MODE_CORAL_CDN:{ + Pcurr_mirror=find_mirror(strip_mirror_name(segment->url)); + break; + } + default:{ + Pcurr_mirror=&network_array[network_num].benchmarked_mirror_list[mirror_num]; + } } timeval now_time; -- cgit v1.2.3-65-gdbad