[mirrorbrain-commits] [opensuse-svn] r6561 - in trunk/tools/download-redirector-v2: . mod_mirrorbrain

From: Novell Forge SVN <noreply_at_novell.com>
Date: Tue, 24 Feb 2009 09:37:07 -0700 (MST)
Author: poeml
Date: 2009-02-24 09:37:05 -0700 (Tue, 24 Feb 2009)
New Revision: 6561

Modified:
   trunk/tools/download-redirector-v2/BUGS
   trunk/tools/download-redirector-v2/mod_mirrorbrain/mod_mirrorbrain.c
Log:
mod_mirrorbrain:
- fix selection of mirrors into the metalinks, which didn't respect the *_only
  flags so far.


Modified: trunk/tools/download-redirector-v2/BUGS
===================================================================
--- trunk/tools/download-redirector-v2/BUGS	2009-02-24 16:33:01 UTC (rev 6560)
+++ trunk/tools/download-redirector-v2/BUGS	2009-02-24 16:37:05 UTC (rev 6561)
_at_@ -20,8 +20,6 @@
 
 * check if the Vary header on Accept is added on all requests!
 
-* country_only mirrors show up in metalinks
-
 * mod_geoip should be required as mod_form - and Apache should check at
   startup. On the other hand, it could be optional, because mod_mirrorbrain
   also works without mod_geoip (distributing requests world-wide, according to

Modified: trunk/tools/download-redirector-v2/mod_mirrorbrain/mod_mirrorbrain.c
===================================================================
--- trunk/tools/download-redirector-v2/mod_mirrorbrain/mod_mirrorbrain.c	2009-02-24 16:33:01 UTC (rev 6560)
+++ trunk/tools/download-redirector-v2/mod_mirrorbrain/mod_mirrorbrain.c	2009-02-24 16:37:05 UTC (rev 6561)
_at_@ -1251,14 +1251,14 @@
 
         /* same AS? */
         else if ((strcmp(new->as, as) == 0) 
-                   && (new->prefix_only != 1)) {
+                   && !new->prefix_only) {
             *(void **)apr_array_push(mirrors_same_as) = new;
         }
 
         /* same country? */
         else if ((strcasecmp(new->country_code, country_code) == 0) 
-                   && (new->as_only != 1)
-                   && (new->prefix_only != 1)) {
+                   && !new->as_only
+                   && !new->prefix_only) {
             *(void **)apr_array_push(mirrors_same_country) = new;
         }
 
_at_@ -1282,19 +1282,19 @@
         /* to be actually considered for this group, the mirror must be willing 
          * to take redirects from foreign country */
         else if ((strcasecmp(new->region, continent_code) == 0) 
-                    && (new->country_only != 1)
-                    && (new->as_only != 1)
-                    && (new->prefix_only != 1)) {
+                    && !new->country_only
+                    && !new->as_only
+                    && !new->prefix_only) {
             *(void **)apr_array_push(mirrors_same_region) = new;
         }
 
         /* to be considered as "worldwide" mirror, it must be willing 
          * to take redirects from foreign regions.
          * (N.B. region_only implies country_only)  */
-        else if ((new->region_only != 1) 
-                    && (new->country_only != 1)
-                    && (new->as_only != 1)
-                    && (new->prefix_only != 1)) {
+        else if (!new->region_only 
+                    && !new->country_only
+                    && !new->as_only
+                    && !new->prefix_only) {
             *(void **)apr_array_push(mirrors_elsewhere) = new;
         }
 
_at_@ -1629,8 +1629,10 @@
                    (strcmp(as, "--") == 0) ? "unknown" : as);
         mirrorp = (mirror_entry_t **)mirrors_same_as->elts;
         for (i = 0; i < mirrors_same_as->nelts; i++) {
+            mirror = mirrorp[i];
+            if (mirror->prefix_only)
+                continue;
             if (pref) pref--;
-            mirror = mirrorp[i];
             ap_rprintf(r, "      <url type=\"http\" location=\"%s\" preference=\"%d\">%s%s</url>\n", 
                        mirror->country_code,
                        pref,
_at_@ -1642,8 +1644,10 @@
                    (strcmp(country_code, "--") == 0) ? "unknown" : country_code);
         mirrorp = (mirror_entry_t **)mirrors_same_country->elts;
         for (i = 0; i < mirrors_same_country->nelts; i++) {
+            mirror = mirrorp[i];
+            if (mirror->prefix_only || mirror->as_only)
+                continue;
             if (pref) pref--;
-            mirror = mirrorp[i];
             ap_rprintf(r, "      <url type=\"http\" location=\"%s\" preference=\"%d\">%s%s</url>\n", 
                        mirror->country_code,
                        pref,
_at_@ -1654,8 +1658,10 @@
                    (strcmp(continent_code, "--") == 0) ? "unknown" : continent_code);
         mirrorp = (mirror_entry_t **)mirrors_same_region->elts;
         for (i = 0; i < mirrors_same_region->nelts; i++) {
+            mirror = mirrorp[i];
+            if (mirror->prefix_only || mirror->as_only || mirror->country_only)
+                continue;
             if (pref) pref--;
-            mirror = mirrorp[i];
             ap_rprintf(r, "      <url type=\"http\" location=\"%s\" preference=\"%d\">%s%s</url>\n", 
                        mirror->country_code,
                        pref,
_at_@ -1665,8 +1671,12 @@
         ap_rputs("\n      <!-- Mirrors in the rest of the world: -->\n", r);
         mirrorp = (mirror_entry_t **)mirrors_elsewhere->elts;
         for (i = 0; i < mirrors_elsewhere->nelts; i++) {
+            mirror = mirrorp[i];
+            if (mirror->prefix_only || mirror->as_only 
+                    || mirror->country_only || mirror->region_only) {
+                continue;
+            }
             if (pref) pref--;
-            mirror = mirrorp[i];
             ap_rprintf(r, "      <url type=\"http\" location=\"%s\" preference=\"%d\">%s%s</url>\n", 
                        mirror->country_code,
                        pref,

_______________________________________________
Opensuse-svn mailing list
Opensuse-svn_at_forge.novell.com
http://forge.novell.com/mailman/listinfo/opensuse-svn


_______________________________________________
mirrorbrain-commits mailing list

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Tue Feb 24 2009 - 16:37:35 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT