[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] move some code around when we"re succeeding or failing at f...



Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	directory.c 
Log Message:
move some code around when we're succeeding or failing at fetching
server descs.
also clean up some formatting.


Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.291
retrieving revision 1.292
diff -u -d -r1.291 -r1.292
--- directory.c	26 Sep 2005 16:37:39 -0000	1.291
+++ directory.c	29 Sep 2005 23:06:48 -0000	1.292
@@ -148,7 +148,8 @@
         if (!fascist_firewall_allows_address(ds->addr,ds->dir_port))
           continue;
       }
-      directory_initiate_command_trusted_dir(ds, purpose, purpose_is_private(purpose),
+      directory_initiate_command_trusted_dir(ds, purpose,
+                                             purpose_is_private(purpose),
                                              NULL, payload, payload_len);
     });
 }
@@ -216,9 +217,11 @@
   }
 
   if (r)
-    directory_initiate_command_router(r, purpose, !directconn, resource, NULL, 0);
+    directory_initiate_command_router(r, purpose, !directconn,
+                                      resource, NULL, 0);
   else if (ds)
-    directory_initiate_command_trusted_dir(ds, purpose, !directconn, resource, NULL, 0);
+    directory_initiate_command_trusted_dir(ds, purpose, !directconn,
+                                           resource, NULL, 0);
   else {
     log_fn(LOG_NOTICE,"No running dirservers known. Will try again later. (purpose %d)",
            purpose);
@@ -259,8 +262,9 @@
                                        const char *resource,
                                        const char *payload, size_t payload_len)
 {
-  directory_initiate_command(dirserv->address, dirserv->addr,dirserv->dir_port,
-               NULL, dirserv->digest, purpose, private_connection, resource,
+  directory_initiate_command(dirserv->address, dirserv->addr,
+               dirserv->dir_port, NULL, dirserv->digest, purpose,
+               private_connection, resource,
                payload, payload_len);
 }
 
@@ -964,7 +968,7 @@
         break;
     }
     routers_update_all_from_networkstatus();/*launches router downloads*/
-    directory_info_has_arrived(time(NULL),0);
+    directory_info_has_arrived(time(NULL), 0);
     if (which) {
       if (smartlist_len(which)) {
         dir_networkstatus_download_failed(which);
@@ -992,19 +996,19 @@
              "Received http status code %d (\"%s\") from server '%s:%d' while fetching \"/tor/server/%s\". I'll try again soon.",
              status_code, reason, conn->address, conn->port,
              conn->requested_resource);
-      tor_free(body); tor_free(headers); tor_free(reason);
       if (!which) {
         connection_dir_download_routerdesc_failed(conn);
       } else {
         dir_routerdesc_download_failed(which);
         SMARTLIST_FOREACH(which, char *, cp, tor_free(cp));
         smartlist_free(which);
-        return -1;
       }
+      tor_free(body); tor_free(headers); tor_free(reason);
+      return -1;
     }
-    router_load_routers_from_string(body, 0, which);
-    directory_info_has_arrived(time(NULL),0);
     if (which) {
+      router_load_routers_from_string(body, 0, which);
+      directory_info_has_arrived(time(NULL), 0);
       log_fn(LOG_NOTICE, "Received %d/%d routers.",
              n_asked_for-smartlist_len(which), n_asked_for);
       if (smartlist_len(which)) {