Browse code

freshclam/manager.c: improve handling of problematic mirrors (bb#1758)

Tomasz Kojm authored on 2009/12/04 23:59:20
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Dec  4 15:55:51 CET 2009 (tk)
2
+---------------------------------
3
+ * freshclam/manager.c: improve handling of problematic mirrors (bb#1758)
4
+
1 5
 Fri Dec  4 14:19:23 CET 2009 (tk)
2 6
 ---------------------------------
3 7
  * clamscan: properly describe --include/exclude (bb#1765)
... ...
@@ -1126,10 +1126,9 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna
1126 1126
 	    return 57; /* FIXME */
1127 1127
 	}
1128 1128
 
1129
-        if(totalsize > 0) {
1130
-	    totaldownloaded += bread;
1129
+	totaldownloaded += bread;
1130
+        if(totalsize > 0)
1131 1131
             percentage = (int) (100 * (float) totaldownloaded / totalsize);
1132
-	}
1133 1132
 
1134 1133
         if(!mprintf_quiet) {
1135 1134
             if(totalsize > 0) {
... ...
@@ -1145,9 +1144,9 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna
1145 1145
     closesocket(sd);
1146 1146
     close(fd);
1147 1147
 
1148
-    if(bread == -1) {
1148
+    if(bread == -1 || !totaldownloaded) {
1149 1149
 	logg("%cgetfile: Download interrupted: %s (IP: %s)\n", logerr ? '!' : '^', strerror(errno), ipaddr);
1150
-	mirman_update(mdat->currip, mdat->af, mdat, 1);
1150
+	mirman_update(mdat->currip, mdat->af, mdat, 2);
1151 1151
 	return 52;
1152 1152
     }
1153 1153