git-svn: trunk@2660
Tomasz Kojm authored on 2007/01/31 22:24:04... | ... |
@@ -421,7 +421,7 @@ int main(int argc, char **argv) |
421 | 421 |
|
422 | 422 |
|
423 | 423 |
if(opt_check(opt, "list-mirrors")) { |
424 |
- if(mirman_read("mirrors.dat", &mdat) == -1) { |
|
424 |
+ if(mirman_read("mirrors.dat", &mdat, 1) == -1) { |
|
425 | 425 |
printf("Can't read mirrors.dat\n"); |
426 | 426 |
return 55; |
427 | 427 |
} |
... | ... |
@@ -1123,7 +1123,10 @@ int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, c |
1123 | 1123 |
localip = cpt->strarg; |
1124 | 1124 |
} |
1125 | 1125 |
|
1126 |
- mirman_read("mirrors.dat", &mdat); |
|
1126 |
+ if(cfgopt(copt, "HTTPProxyServer")->enabled) |
|
1127 |
+ mirman_read("mirrors.dat", &mdat, 0); |
|
1128 |
+ else |
|
1129 |
+ mirman_read("mirrors.dat", &mdat, 1); |
|
1127 | 1130 |
|
1128 | 1131 |
memset(ipaddr, 0, sizeof(ipaddr)); |
1129 | 1132 |
|
... | ... |
@@ -56,7 +56,7 @@ void mirman_free(struct mirdat *mdat) |
56 | 56 |
} |
57 | 57 |
} |
58 | 58 |
|
59 |
-int mirman_read(const char *file, struct mirdat *mdat) |
|
59 |
+int mirman_read(const char *file, struct mirdat *mdat, uint8_t active) |
|
60 | 60 |
{ |
61 | 61 |
struct mirdat_ip mip; |
62 | 62 |
int fd, bread; |
... | ... |
@@ -64,6 +64,9 @@ int mirman_read(const char *file, struct mirdat *mdat) |
64 | 64 |
|
65 | 65 |
memset(mdat, 0, sizeof(struct mirdat)); |
66 | 66 |
|
67 |
+ if(!(mdat->active = active)) |
|
68 |
+ return 0; |
|
69 |
+ |
|
67 | 70 |
if((fd = open(file, O_RDONLY|O_BINARY)) == -1) |
68 | 71 |
return -1; |
69 | 72 |
|
... | ... |
@@ -96,6 +99,9 @@ int mirman_check(uint32_t ip, struct mirdat *mdat) |
96 | 96 |
unsigned int i, flevel = cl_retflevel(); |
97 | 97 |
|
98 | 98 |
|
99 |
+ if(!mdat->active) |
|
100 |
+ return 0; |
|
101 |
+ |
|
99 | 102 |
for(i = 0; i < mdat->num; i++) { |
100 | 103 |
if(mdat->mirtab[i].ip == ip) { |
101 | 104 |
|
... | ... |
@@ -122,6 +128,9 @@ int mirman_update(uint32_t ip, struct mirdat *mdat, uint8_t broken) |
122 | 122 |
unsigned int i, found = 0; |
123 | 123 |
|
124 | 124 |
|
125 |
+ if(!mdat->active) |
|
126 |
+ return 0; |
|
127 |
+ |
|
125 | 128 |
for(i = 0; i < mdat->num; i++) { |
126 | 129 |
if(mdat->mirtab[i].ip == ip) { |
127 | 130 |
found = 1; |
... | ... |
@@ -31,13 +31,14 @@ struct mirdat_ip { |
31 | 31 |
}; |
32 | 32 |
|
33 | 33 |
struct mirdat { |
34 |
+ uint8_t active; |
|
34 | 35 |
unsigned int num; |
35 | 36 |
uint32_t currip; |
36 | 37 |
uint32_t dbflevel; |
37 | 38 |
struct mirdat_ip *mirtab; |
38 | 39 |
}; |
39 | 40 |
|
40 |
-int mirman_read(const char *file, struct mirdat *mdat); |
|
41 |
+int mirman_read(const char *file, struct mirdat *mdat, uint8_t active); |
|
41 | 42 |
int mirman_check(uint32_t ip, struct mirdat *mdat); |
42 | 43 |
int mirman_update(uint32_t ip, struct mirdat *mdat, uint8_t broken); |
43 | 44 |
void mirman_list(const struct mirdat *mdat); |