summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostyantyn Ovechko <fastinetserver@gmail.com>2010-07-21 23:56:57 +0300
committerKostyantyn Ovechko <fastinetserver@gmail.com>2010-07-21 23:56:57 +0300
commit1d729deb820fef1829358352a505c3eb05ba26b9 (patch)
tree7d294633723f95f80668a87633c6aad24476a611
parentSeparate logging into log.h and log.cpp files. Add option value "none" to dis... (diff)
downloadidfetch-1d729deb820fef1829358352a505c3eb05ba26b9.tar.gz
idfetch-1d729deb820fef1829358352a505c3eb05ba26b9.tar.bz2
idfetch-1d729deb820fef1829358352a505c3eb05ba26b9.zip
Add explanations for CURL error codes to logs.
-rw-r--r--segget/connection.cpp22
-rw-r--r--segget/connection.h2
-rw-r--r--segget/segget.cpp8
3 files changed, 23 insertions, 9 deletions
diff --git a/segget/connection.cpp b/segget/connection.cpp
index affa21f..5dec26a 100644
--- a/segget/connection.cpp
+++ b/segget/connection.cpp
@@ -76,12 +76,26 @@ void Tconnection::start(CURLM *cm, uint network_number, uint distfile_num, Tsegm
error_log("Error in connection.cpp: start()");
}
}
-
-void Tconnection::stop(int connection_result){
+/*
+string explain_curl_error(int error_code){
+ try{
+ //curl_easy_strerror(
+ }catch(...){
+ error_log("Error in connection.cpp: explain_curl_error()");
+ }
+ return "Error in connection.cpp: explain_curl_error()";
+}
+*/
+void Tconnection::stop(CURLcode connection_result){
try{
stats.active_connections_counter--;
debug("Finished connection for distfile: "+segment->parent_distfile->name+" Segment#:"+toString(segment->segment_num)+" Network#"+toString(network_num)+" Status: "+toString(connection_result));
- error_log("Finished connection for distfile: "+segment->parent_distfile->name+" Segment#:"+toString(segment->segment_num)+" Network#"+toString(network_num)+" Status: "+toString(connection_result));
+ if (connection_result){
+ string error_str=curl_easy_strerror(connection_result);
+ debug(" ERROR "+toString(connection_result)+": "+error_str);
+ error_log("Finished connection for distfile: "+segment->parent_distfile->name+" Segment#:"+toString(segment->segment_num)+" Network#"+toString(network_num)+" Status: "+toString(connection_result));
+ error_log(" ERROR "+toString(connection_result)+": "+error_str);
+ }
msg_clean_connection(connection_num);
active=false;
@@ -92,7 +106,7 @@ void Tconnection::stop(int connection_result){
if (! segment->segment_verification_is_ok()){
debug("curl_lies - there is a problem downloading segment");
error_log("curl_lies - there is a problem downloading segment");
- connection_result=100;
+ connection_result=CURLE_READ_ERROR;
}
}
diff --git a/segget/connection.h b/segget/connection.h
index 972792f..bdb4a59 100644
--- a/segget/connection.h
+++ b/segget/connection.h
@@ -60,7 +60,7 @@ class Tconnection{
start_time(),
segment(0){};
void start(CURLM *cm, uint network_number, uint distfile_num, Tsegment *started_segment, uint best_mirror_num);
- void stop(int connection_result);
+ void stop(CURLcode connection_result);
void inc_bytes_per_last_interval(ulong new_bytes_count);
void show_connection_progress(ulong time_diff);
};
diff --git a/segget/segget.cpp b/segget/segget.cpp
index a1978ae..e5110a3 100644
--- a/segget/segget.cpp
+++ b/segget/segget.cpp
@@ -255,12 +255,12 @@ int download_pkgs(){
Tsegment *current_segment;
CURL *e = msg->easy_handle;
curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &current_segment);
- int connection_result=msg->data.result;
- string result_msg_text="RESULT:"+toString(connection_result)+" "+curl_easy_strerror(msg->data.result)+" while downloading segment";
- msg_status1(current_segment->connection_num,current_segment->segment_num,result_msg_text);
+// CURLcode connection_result=msg->data.result;
+// string result_msg_text="RESULT:"+toString(connection_result)+" "+curl_easy_strerror(msg->data.result)+" while downloading segment";
+// msg_status1(current_segment->connection_num,current_segment->segment_num,result_msg_text);
curl_multi_remove_handle(cm, e);
- connection_array[current_segment->connection_num].stop(connection_result);
+ connection_array[current_segment->connection_num].stop(msg->data.result);
// if (not choose_segment(current_segment->connection_num)) {
// U++; // just to prevent it from remaining at 0 if there are more URLs to get