[or-cvs] the things we do for our windows users.

arma at seul.org arma at seul.org
Mon Feb 13 09:37:55 UTC 2006


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

Modified Files:
	directory.c dirserv.c dns.c hibernate.c main.c onion.c 
Log Message:
the things we do for our windows users.
i hope they appreciate it.


Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.354
retrieving revision 1.355
diff -u -p -d -r1.354 -r1.355
--- directory.c	12 Feb 2006 23:44:02 -0000	1.354
+++ directory.c	13 Feb 2006 09:37:53 -0000	1.355
@@ -102,7 +102,7 @@ dir_policy_permits_address(uint32_t addr
     return 0;
   else if (a==ADDR_POLICY_ACCEPTED)
     return 1;
-  warn(LD_BUG, "Bug: got unexpected 'maybe' answer from dir policy");
+  log_warn(LD_BUG, "Bug: got unexpected 'maybe' answer from dir policy");
   return 0;
 }
 
@@ -191,8 +191,9 @@ directory_get_from_dirserver(uint8_t pur
           which = "network status";
         else // if (purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS)
           which = "server descriptors";
-        info(LD_DIR,
-             "No router found for %s; falling back to dirserver list", which);
+        log_info(LD_DIR,
+                 "No router found for %s; falling back to dirserver list",
+                 which);
         rs = router_pick_trusteddirserver(1, 1, 1,
                                           retry_if_no_servers);
         if (!rs)
@@ -219,9 +220,9 @@ directory_get_from_dirserver(uint8_t pur
     directory_initiate_command_routerstatus(rs, purpose, !directconn,
                                             resource, NULL, 0);
   else {
-    notice(LD_DIR,
-           "No running dirservers known. Will try again later. (purpose %d)",
-           purpose);
+    log_notice(LD_DIR,
+               "No running dirservers known. Will try again later. "
+               "(purpose %d)", purpose);
     if (!purpose_is_private(purpose)) {
       /* remember we tried them all and failed. */
       directory_all_unreachable(time(NULL));
@@ -304,17 +305,17 @@ connection_dir_request_failed(connection
   router_mark_as_down(conn->identity_digest); /* don't try him again */
   if (conn->purpose == DIR_PURPOSE_FETCH_DIR ||
       conn->purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
-    info(LD_DIR, "Giving up on directory server at '%s:%d'; retrying",
-         conn->address, conn->port);
+    log_info(LD_DIR, "Giving up on directory server at '%s:%d'; retrying",
+             conn->address, conn->port);
     directory_get_from_dirserver(conn->purpose, NULL,
                                  0 /* don't retry_if_no_servers */);
   } else if (conn->purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
-    info(LD_DIR, "Giving up on directory server at '%s'; retrying",
-         conn->address);
+    log_info(LD_DIR, "Giving up on directory server at '%s'; retrying",
+             conn->address);
     connection_dir_download_networkstatus_failed(conn);
   } else if (conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC) {
-    info(LD_DIR, "Giving up on directory server at '%s'; retrying",
-         conn->address);
+    log_info(LD_DIR, "Giving up on directory server at '%s'; retrying",
+             conn->address);
     connection_dir_download_routerdesc_failed(conn);
   }
 }
@@ -382,28 +383,28 @@ directory_initiate_command(const char *a
 
   switch (purpose) {
     case DIR_PURPOSE_FETCH_DIR:
-      debug(LD_DIR,"initiating directory fetch");
+      log_debug(LD_DIR,"initiating directory fetch");
       break;
     case DIR_PURPOSE_FETCH_RENDDESC:
-      debug(LD_DIR,"initiating hidden-service descriptor fetch");
+      log_debug(LD_DIR,"initiating hidden-service descriptor fetch");
       break;
     case DIR_PURPOSE_UPLOAD_DIR:
-      debug(LD_OR,"initiating server descriptor upload");
+      log_debug(LD_OR,"initiating server descriptor upload");
       break;
     case DIR_PURPOSE_UPLOAD_RENDDESC:
-      debug(LD_REND,"initiating hidden-service descriptor upload");
+      log_debug(LD_REND,"initiating hidden-service descriptor upload");
       break;
     case DIR_PURPOSE_FETCH_RUNNING_LIST:
-      debug(LD_DIR,"initiating running-routers fetch");
+      log_debug(LD_DIR,"initiating running-routers fetch");
       break;
     case DIR_PURPOSE_FETCH_NETWORKSTATUS:
-      debug(LD_DIR,"initiating network-status fetch");
+      log_debug(LD_DIR,"initiating network-status fetch");
       break;
     case DIR_PURPOSE_FETCH_SERVERDESC:
-      debug(LD_DIR,"initiating server descriptor fetch");
+      log_debug(LD_DIR,"initiating server descriptor fetch");
       break;
     default:
-      err(LD_BUG, "Unrecognized directory connection purpose.");
+      log_err(LD_BUG, "Unrecognized directory connection purpose.");
       tor_assert(0);
   }
 
@@ -451,13 +452,13 @@ directory_initiate_command(const char *a
      */
     conn->s = connection_ap_make_bridge(conn->address, conn->port);
     if (conn->s < 0) {
-      warn(LD_NET,"Making AP bridge to dirserver failed.");
+      log_warn(LD_NET,"Making AP bridge to dirserver failed.");
       connection_mark_for_close(conn);
       return;
     }
 
     if (connection_add(conn) < 0) {
-      warn(LD_NET,"Unable to add AP bridge to dirserver.");
+      log_warn(LD_NET,"Unable to add AP bridge to dirserver.");
       connection_mark_for_close(conn);
       return;
     }
@@ -509,7 +510,7 @@ directory_send_command(connection_t *con
     if (authenticator) {
       base64_authenticator = alloc_http_authenticator(authenticator);
       if (!base64_authenticator)
-        warn(LD_BUG, "Encoding http authenticator failed");
+        log_warn(LD_BUG, "Encoding http authenticator failed");
     }
     if (base64_authenticator) {
       tor_snprintf(proxyauthstring, sizeof(proxyauthstring),
@@ -528,8 +529,9 @@ directory_send_command(connection_t *con
     case DIR_PURPOSE_FETCH_DIR:
       tor_assert(!resource);
       tor_assert(!payload);
-      debug(LD_DIR, "Asking for compressed directory from server running %s",
-            platform?platform:"<unknown version>");
+      log_debug(LD_DIR,
+                "Asking for compressed directory from server running %s",
+                platform?platform:"<unknown version>");
       httpcommand = "GET";
       url = tor_strdup("/tor/dir.z");
       break;
@@ -586,10 +588,10 @@ directory_send_command(connection_t *con
   }
 
   if (strlen(proxystring) + strlen(url) >= 4096) {
-    warn(LD_BUG,
-         "Bug: squid does not like URLs longer than 4095 bytes, this "
-         "one is %d bytes long: %s%s",
-         (int)(strlen(proxystring) + strlen(url)), proxystring, url);
+    log_warn(LD_BUG,
+             "Bug: squid does not like URLs longer than 4095 bytes, this "
+             "one is %d bytes long: %s%s",
+             (int)(strlen(proxystring) + strlen(url)), proxystring, url);
   }
 
   tor_snprintf(request, sizeof(request), "%s %s", httpcommand, proxystring);
@@ -649,7 +651,7 @@ parse_http_url(char *headers, char **url
     if (s-tmp >= 3 && !strcmpstart(tmp,"://")) {
       tmp = strchr(tmp+3, '/');
       if (tmp && tmp < s) {
-        debug(LD_DIR,"Skipping over 'http[s]://hostname' string");
+        log_debug(LD_DIR,"Skipping over 'http[s]://hostname' string");
         start = tmp;
       }
     }
@@ -746,7 +748,7 @@ parse_http_response(const char *headers,
   if (sscanf(headers, "HTTP/1.%d %d", &n1, &n2) < 2 ||
       (n1 != 0 && n1 != 1) ||
       (n2 < 100 || n2 >= 600)) {
-    warn(LD_HTTP,"Failed to parse header '%s'",headers);
+    log_warn(LD_HTTP,"Failed to parse header '%s'",headers);
     return -1;
   }
   *code = n2;
@@ -793,8 +795,8 @@ parse_http_response(const char *headers,
     } else if (!strcmp(enc, "gzip") || !strcmp(enc, "x-gzip")) {
       *compression = GZIP_METHOD;
     } else {
-      info(LD_HTTP, "Unrecognized content encoding: '%s'. Trying to deal.",
-           enc);
+      log_info(LD_HTTP, "Unrecognized content encoding: '%s'. Trying to deal.",
+               enc);
       *compression = -1;
     }
   }
@@ -861,12 +863,13 @@ connection_dir_client_reached_eof(connec
                               &body, &body_len, MAX_DIR_SIZE,
                               allow_partial)) {
     case -1: /* overflow */
-      warn(LD_PROTOCOL,"'fetch' response too large (server '%s:%d'). Closing.",
-           conn->address, conn->port);
+      log_warn(LD_PROTOCOL,
+               "'fetch' response too large (server '%s:%d'). Closing.",
+               conn->address, conn->port);
       return -1;
     case 0:
-      info(LD_HTTP,
-           "'fetch' response not all here, but we're at eof. Closing.");
+      log_info(LD_HTTP,
+               "'fetch' response not all here, but we're at eof. Closing.");
       return -1;
     /* case 1, fall through */
   }
@@ -874,16 +877,16 @@ connection_dir_client_reached_eof(connec
 
   if (parse_http_response(headers, &status_code, &date_header,
                           &compression, &reason) < 0) {
-    warn(LD_HTTP,"Unparseable headers (server '%s:%d'). Closing.",
-         conn->address, conn->port);
+    log_warn(LD_HTTP,"Unparseable headers (server '%s:%d'). Closing.",
+             conn->address, conn->port);
     tor_free(body); tor_free(headers);
     return -1;
   }
   if (!reason) reason = tor_strdup("[no reason given]");
 
-  debug(LD_DIR,
-        "Received response from directory server '%s:%d': %d \"%s\"",
-        conn->address, conn->port, status_code, reason);
+  log_debug(LD_DIR,
+            "Received response from directory server '%s:%d': %d \"%s\"",
+            conn->address, conn->port, status_code, reason);
 
   if (date_header > 0) {
     now = time(NULL);
@@ -899,15 +902,15 @@ connection_dir_client_reached_eof(connec
              abs(delta)/60, delta>0 ? "behind" : "ahead");
       skewed = 1; /* don't check the recommended-versions line */
     } else {
-      debug(LD_HTTP, "Time on received directory is within tolerance; "
-            "we are %d seconds skewed.  (That's okay.)", delta);
+      log_debug(LD_HTTP, "Time on received directory is within tolerance; "
+                "we are %d seconds skewed.  (That's okay.)", delta);
     }
   }
 
   if (status_code == 503) {
-    info(LD_DIR,"Received http status code %d (\"%s\") from server "
-         "'%s:%d'. I'll try again soon.",
-         status_code, reason, conn->address, conn->port);
+    log_info(LD_DIR,"Received http status code %d (\"%s\") from server "
+             "'%s:%d'. I'll try again soon.",
+             status_code, reason, conn->address, conn->port);
     tor_free(body); tor_free(headers); tor_free(reason);
     return -1;
   }
@@ -937,10 +940,10 @@ connection_dir_client_reached_eof(connec
       else
         description2 = "uncompressed";
 
-      info(LD_HTTP, "HTTP body from server '%s:%d' was labeled %s, "
-           "but it seems to be %s.%s",
-           conn->address, conn->port, description1, description2,
-           (compression>0 && guessed>0)?"  Trying both.":"");
+      log_info(LD_HTTP, "HTTP body from server '%s:%d' was labeled %s, "
+               "but it seems to be %s.%s",
+               conn->address, conn->port, description1, description2,
+               (compression>0 && guessed>0)?"  Trying both.":"");
     }
     /* Try declared compression first if we can. */
     if (compression > 0)
@@ -970,36 +973,36 @@ connection_dir_client_reached_eof(connec
 
   if (conn->purpose == DIR_PURPOSE_FETCH_DIR) {
     /* fetch/process the directory to cache it. */
-    info(LD_DIR,"Received directory (size %d) from server '%s:%d'",
-         (int)body_len, conn->address, conn->port);
+    log_info(LD_DIR,"Received directory (size %d) from server '%s:%d'",
+             (int)body_len, conn->address, conn->port);
     if (status_code != 200) {
-      warn(LD_DIR,"Received http status code %d (\"%s\") from server "
-           "'%s:%d'. I'll try again soon.",
-           status_code, reason, conn->address, conn->port);
+      log_warn(LD_DIR,"Received http status code %d (\"%s\") from server "
+               "'%s:%d'. I'll try again soon.",
+               status_code, reason, conn->address, conn->port);
       tor_free(body); tor_free(headers); tor_free(reason);
       return -1;
     }
     if (router_parse_directory(body) < 0) {
-      notice(LD_DIR,"I failed to parse the directory I fetched from "
-             "'%s:%d'. Ignoring.", conn->address, conn->port);
+      log_notice(LD_DIR,"I failed to parse the directory I fetched from "
+                 "'%s:%d'. Ignoring.", conn->address, conn->port);
     }
     note_request(was_compressed?"dl/dir.z":"dl/dir", orig_len);
   }
 
   if (conn->purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
     /* just update our list of running routers, if this list is new info */
-    info(LD_DIR,"Received running-routers list (size %d)", (int)body_len);
+    log_info(LD_DIR,"Received running-routers list (size %d)", (int)body_len);
     if (status_code != 200) {
-      warn(LD_DIR,"Received http status code %d (\"%s\") from server "
-           "'%s:%d'. I'll try again soon.",
-           status_code, reason, conn->address, conn->port);
+      log_warn(LD_DIR,"Received http status code %d (\"%s\") from server "
+               "'%s:%d'. I'll try again soon.",
+               status_code, reason, conn->address, conn->port);
       tor_free(body); tor_free(headers); tor_free(reason);
       return -1;
     }
     if (router_parse_runningrouters(body)<0) {
-      warn(LD_DIR,"Bad running-routers from server '%s:%d'. I'll try again "
-           "soon.",
-           conn->address, conn->port);
+      log_warn(LD_DIR,
+               "Bad running-routers from server '%s:%d'. I'll try again soon.",
+               conn->address, conn->port);
       tor_free(body); tor_free(headers); tor_free(reason);
       return -1;
     }
@@ -1010,10 +1013,11 @@ connection_dir_client_reached_eof(connec
   if (conn->purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
     smartlist_t *which = NULL;
     char *cp;
-    info(LD_DIR,"Received networkstatus objects (size %d) from server "
-         "'%s:%d'",(int) body_len, conn->address, conn->port);
+    log_info(LD_DIR,"Received networkstatus objects (size %d) from server "
+             "'%s:%d'",(int) body_len, conn->address, conn->port);
     if (status_code != 200) {
-      warn(LD_DIR,"Received http status code %d (\"%s\") from server "
+      log_warn(LD_DIR,
+           "Received http status code %d (\"%s\") from server "
            "'%s:%d' while fetching \"/tor/status/%s\". I'll try again soon.",
            status_code, reason, conn->address, conn->port,
            conn->requested_resource);
@@ -1057,8 +1061,8 @@ connection_dir_client_reached_eof(connec
   if (conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC) {
     smartlist_t *which = NULL;
     int n_asked_for = 0;
-    info(LD_DIR,"Received server info (size %d) from server '%s:%d'",
-         (int)body_len, conn->address, conn->port);
+    log_info(LD_DIR,"Received server info (size %d) from server '%s:%d'",
+             (int)body_len, conn->address, conn->port);
     note_request(was_compressed?"dl/server.z":"dl/server", orig_len);
     if (conn->requested_resource &&
         !strcmpstart(conn->requested_resource,"d/")) {
@@ -1099,9 +1103,9 @@ connection_dir_client_reached_eof(connec
       directory_info_has_arrived(time(NULL), 0);
     }
     if (which) { /* mark remaining ones as failed */
-      info(LD_DIR, "Received %d/%d routers requested from %s:%d",
-           n_asked_for-smartlist_len(which), n_asked_for,
-           conn->address, (int)conn->port);
+      log_info(LD_DIR, "Received %d/%d routers requested from %s:%d",
+               n_asked_for-smartlist_len(which), n_asked_for,
+               conn->address, (int)conn->port);
       if (smartlist_len(which)) {
         dir_routerdesc_download_failed(which);
       }
@@ -1123,24 +1127,25 @@ connection_dir_client_reached_eof(connec
   if (conn->purpose == DIR_PURPOSE_UPLOAD_DIR) {
     switch (status_code) {
       case 200:
-        info(LD_GENERAL,"eof (status 200) after uploading server "
-             "descriptor: finished.");
+        log_info(LD_GENERAL,"eof (status 200) after uploading server "
+                 "descriptor: finished.");
         break;
       case 400:
-        warn(LD_GENERAL,"http status 400 (\"%s\") response from "
-             "dirserver '%s:%d'. Please correct.",
-             reason, conn->address, conn->port);
+        log_warn(LD_GENERAL,"http status 400 (\"%s\") response from "
+                 "dirserver '%s:%d'. Please correct.",
+                 reason, conn->address, conn->port);
         break;
       case 403:
-        warn(LD_GENERAL,"http status 403 (\"%s\") response from dirserver "
+        log_warn(LD_GENERAL,
+             "http status 403 (\"%s\") response from dirserver "
              "'%s:%d'. Is your clock skewed? Have you mailed us your key "
              "fingerprint? Are you using the right key? Are you using a "
              "private IP address? See http://tor.eff.org/doc/"
              "tor-doc-server.html", reason, conn->address, conn->port);
         break;
       default:
-        warn(LD_GENERAL,"http status %d (\"%s\") reason unexpected (server "
-             "'%s:%d').",
+        log_warn(LD_GENERAL,
+             "http status %d (\"%s\") reason unexpected (server '%s:%d').",
              status_code, reason, conn->address, conn->port);
         break;
     }
@@ -1149,13 +1154,13 @@ connection_dir_client_reached_eof(connec
   }
 
   if (conn->purpose == DIR_PURPOSE_FETCH_RENDDESC) {
-    info(LD_REND,"Received rendezvous descriptor (size %d, status %d "
-         "(\"%s\"))",
-         (int)body_len, status_code, reason);
+    log_info(LD_REND,"Received rendezvous descriptor (size %d, status %d "
+             "(\"%s\"))",
+             (int)body_len, status_code, reason);
     switch (status_code) {
       case 200:
         if (rend_cache_store(body, body_len) < 0) {
-          warn(LD_REND,"Failed to store rendezvous descriptor.");
+          log_warn(LD_REND,"Failed to store rendezvous descriptor.");
           /* alice's ap_stream will notice when connection_mark_for_close
            * cleans it up */
         } else {
@@ -1169,11 +1174,12 @@ connection_dir_client_reached_eof(connec
          * connection_mark_for_close cleans it up. */
         break;
       case 400:
-        warn(LD_REND,"http status 400 (\"%s\"). Dirserver didn't like our "
-             "rendezvous query?", reason);
+        log_warn(LD_REND,
+                 "http status 400 (\"%s\"). Dirserver didn't like our "
+                 "rendezvous query?", reason);
         break;
       default:
-        warn(LD_REND,"http status %d (\"%s\") response unexpected (server "
+        log_warn(LD_REND,"http status %d (\"%s\") response unexpected (server "
              "'%s:%d').",
              status_code, reason, conn->address, conn->port);
         break;
@@ -1183,18 +1189,19 @@ connection_dir_client_reached_eof(connec
   if (conn->purpose == DIR_PURPOSE_UPLOAD_RENDDESC) {
     switch (status_code) {
       case 200:
-        info(LD_REND,"Uploading rendezvous descriptor: finished with status "
-             "200 (\"%s\")", reason);
+        log_info(LD_REND,
+                 "Uploading rendezvous descriptor: finished with status "
+                 "200 (\"%s\")", reason);
         break;
       case 400:
-        warn(LD_REND,"http status 400 (\"%s\") response from dirserver "
-             "'%s:%d'. Malformed rendezvous descriptor?",
-             reason, conn->address, conn->port);
+        log_warn(LD_REND,"http status 400 (\"%s\") response from dirserver "
+                 "'%s:%d'. Malformed rendezvous descriptor?",
+                 reason, conn->address, conn->port);
         break;
       default:
-        warn(LD_REND,"http status %d (\"%s\") response unexpected (server "
-             "'%s:%d').",
-             status_code, reason, conn->address, conn->port);
+        log_warn(LD_REND,"http status %d (\"%s\") response unexpected (server "
+                 "'%s:%d').",
+                 status_code, reason, conn->address, conn->port);
         break;
     }
   }
@@ -1208,7 +1215,7 @@ connection_dir_reached_eof(connection_t 
 {
   int retval;
   if (conn->state != DIR_CONN_STATE_CLIENT_READING) {
-    info(LD_HTTP,"conn reached eof, not reading. Closing.");
+    log_info(LD_HTTP,"conn reached eof, not reading. Closing.");
     connection_close_immediate(conn); /* error: give up on flushing */
     connection_mark_for_close(conn);
     return -1;
@@ -1248,7 +1255,7 @@ connection_dir_process_inbuf(connection_
   /* XXX for READ states, might want to make sure inbuf isn't too big */
 
   if (!conn->inbuf_reached_eof)
-    debug(LD_HTTP,"Got data, not eof. Leaving on inbuf.");
+    log_debug(LD_HTTP,"Got data, not eof. Leaving on inbuf.");
   return 0;
 }
 
@@ -1262,7 +1269,7 @@ write_http_status_line(connection_t *con
   char buf[256];
   if (tor_snprintf(buf, sizeof(buf), "HTTP/1.0 %d %s\r\n\r\n",
       status, reason_phrase) < 0) {
-    warn(LD_BUG,"Bug: status line too long.");
+    log_warn(LD_BUG,"Bug: status line too long.");
     return;
   }
   connection_write_to_buf(buf, strlen(buf), conn);
@@ -1374,7 +1381,7 @@ directory_handle_command_get(connection_
   char tmp[8192];
   char date[RFC1123_TIME_LEN+1];
 
-  debug(LD_DIRSERV,"Received GET command.");
+  log_debug(LD_DIRSERV,"Received GET command.");
 
   conn->state = DIR_CONN_STATE_SERVER_WRITING;
 
@@ -1382,15 +1389,15 @@ directory_handle_command_get(connection_
     write_http_status_line(conn, 400, "Bad request");
     return 0;
   }
-  debug(LD_DIRSERV,"rewritten url as '%s'.", url);
+  log_debug(LD_DIRSERV,"rewritten url as '%s'.", url);
 
   if (!strcmp(url,"/tor/") || !strcmp(url,"/tor/dir.z")) { /* dir fetch */
     int deflated = !strcmp(url,"/tor/dir.z");
     dlen = dirserv_get_directory(&cp, deflated);
 
     if (dlen == 0) {
-      notice(LD_DIRSERV,"Client asked for the mirrored directory, but we "
-             "don't have a good one yet. Sending 503 Dir not available.");
+      log_notice(LD_DIRSERV,"Client asked for the mirrored directory, but we "
+                 "don't have a good one yet. Sending 503 Dir not available.");
       write_http_status_line(conn, 503, "Directory unavailable");
       /* try to get a new one now */
       if (!already_fetching_directory(DIR_PURPOSE_FETCH_DIR))
@@ -1400,9 +1407,9 @@ directory_handle_command_get(connection_
     }
 
     if (global_write_bucket_empty()) {
-      info(LD_DIRSERV,
-           "Client asked for the mirrored directory, but we've been "
-           "writing too many bytes lately. Sending 503 Dir busy.");
+      log_info(LD_DIRSERV,
+               "Client asked for the mirrored directory, but we've been "
+               "writing too many bytes lately. Sending 503 Dir busy.");
       write_http_status_line(conn, 503, "Directory busy, try again later");
       tor_free(url);
       return 0;
@@ -1411,8 +1418,8 @@ directory_handle_command_get(connection_
     note_request(url, dlen);
     tor_free(url);
 
-    debug(LD_DIRSERV,"Dumping %sdirectory to client.",
-          deflated?"deflated ":"");
+    log_debug(LD_DIRSERV,"Dumping %sdirectory to client.",
+              deflated?"deflated ":"");
     format_rfc1123_time(date, time(NULL));
     tor_snprintf(tmp, sizeof(tmp),
                  "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\n"
@@ -1664,7 +1671,7 @@ directory_handle_command_post(connection
   char *origin = NULL;
   char *url = NULL;
 
-  debug(LD_DIRSERV,"Received POST command.");
+  log_debug(LD_DIRSERV,"Received POST command.");
 
   conn->state = DIR_CONN_STATE_SERVER_WRITING;
 
@@ -1680,7 +1687,7 @@ directory_handle_command_post(connection
     write_http_status_line(conn, 400, "Bad request");
     return 0;
   }
-  debug(LD_DIRSERV,"rewritten url as '%s'.", url);
+  log_debug(LD_DIRSERV,"rewritten url as '%s'.", url);
   origin = http_get_origin(headers, conn);
 
   if (!strcmp(url,"/tor/")) { /* server descriptor post */
@@ -1693,7 +1700,7 @@ directory_handle_command_post(connection
       case -2:
       case -1:
       case 1:
-        notice(LD_DIRSERV,"Rejected router descriptor from %s.", origin);
+        log_notice(LD_DIRSERV,"Rejected router descriptor from %s.", origin);
         /* malformed descriptor, or something wrong */
         write_http_status_line(conn, 400, msg);
         break;
@@ -1709,12 +1716,12 @@ directory_handle_command_post(connection
     /* rendezvous descriptor post */
     if (rend_cache_store(body, body_len) < 0) {
 //      char tmp[1024*2+1];
-      notice(LD_DIRSERV,"Rejected rend descriptor (length %d) from %s.",
-             (int)body_len, origin);
+      log_notice(LD_DIRSERV,"Rejected rend descriptor (length %d) from %s.",
+                 (int)body_len, origin);
 #if 0
       if (body_len <= 1024) {
         base16_encode(tmp, sizeof(tmp), body, body_len);
-        notice(LD_DIRSERV,"Body was: %s", tmp);
+        log_notice(LD_DIRSERV,"Body was: %s", tmp);
       }
 #endif
       write_http_status_line(conn, 400, "Invalid service descriptor rejected");
@@ -1752,24 +1759,24 @@ directory_handle_command(connection_t *c
                               &headers, MAX_HEADERS_SIZE,
                               &body, &body_len, MAX_BODY_SIZE, 0)) {
     case -1: /* overflow */
-      warn(LD_DIRSERV,
-           "Invalid input from address '%s'. Closing.", conn->address);
+      log_warn(LD_DIRSERV,
+               "Invalid input from address '%s'. Closing.", conn->address);
       return -1;
     case 0:
-      debug(LD_DIRSERV,"command not all here yet.");
+      log_debug(LD_DIRSERV,"command not all here yet.");
       return 0;
     /* case 1, fall through */
   }
 
-  debug(LD_DIRSERV,"headers '%s', body '%s'.", headers, body);
+  log_debug(LD_DIRSERV,"headers '%s', body '%s'.", headers, body);
 
   if (!strncasecmp(headers,"GET",3))
     r = directory_handle_command_get(conn, headers, body, body_len);
   else if (!strncasecmp(headers,"POST",4))
     r = directory_handle_command_post(conn, headers, body, body_len);
   else {
-    warn(LD_PROTOCOL,"Got headers '%s' with unknown command. Closing.",
-         headers);
+    log_warn(LD_PROTOCOL,"Got headers '%s' with unknown command. Closing.",
+             headers);
     r = -1;
   }
 
@@ -1789,16 +1796,16 @@ connection_dir_finished_flushing(connect
 
   switch (conn->state) {
     case DIR_CONN_STATE_CLIENT_SENDING:
-      debug(LD_DIR,"client finished sending command.");
+      log_debug(LD_DIR,"client finished sending command.");
       conn->state = DIR_CONN_STATE_CLIENT_READING;
       connection_stop_writing(conn);
       return 0;
     case DIR_CONN_STATE_SERVER_WRITING:
-      debug(LD_DIRSERV,"Finished writing server response. Closing.");
+      log_debug(LD_DIRSERV,"Finished writing server response. Closing.");
       connection_mark_for_close(conn);
       return 0;
     default:
-      warn(LD_BUG,"Bug: called in unexpected state %d.", conn->state);
+      log_warn(LD_BUG,"Bug: called in unexpected state %d.", conn->state);
       tor_fragile_assert();
       return -1;
   }
@@ -1814,8 +1821,8 @@ connection_dir_finished_connecting(conne
   tor_assert(conn->type == CONN_TYPE_DIR);
   tor_assert(conn->state == DIR_CONN_STATE_CONNECTING);
 
-  debug(LD_HTTP,"Dir connection to router %s:%u established.",
-        conn->address,conn->port);
+  log_debug(LD_HTTP,"Dir connection to router %s:%u established.",
+            conn->address,conn->port);
 
   conn->state = DIR_CONN_STATE_CLIENT_SENDING; /* start flushing conn */
   return 0;
@@ -1876,14 +1883,15 @@ dir_routerdesc_download_failed(smartlist
       }
     }
     if (rs->next_attempt_at == 0)
-      debug(LD_DIR, "%s failed %d time(s); I'll try again immediately.",
-            cp, (int)rs->n_download_failures);
+      log_debug(LD_DIR, "%s failed %d time(s); I'll try again immediately.",
+                cp, (int)rs->n_download_failures);
     else if (rs->next_attempt_at < TIME_MAX)
-      debug(LD_DIR, "%s failed %d time(s); I'll try again in %d seconds.",
-            cp, (int)rs->n_download_failures, (int)(rs->next_attempt_at-now));
+      log_debug(LD_DIR, "%s failed %d time(s); I'll try again in %d seconds.",
+                cp, (int)rs->n_download_failures,
+                (int)(rs->next_attempt_at-now));
     else
-      debug(LD_DIR, "%s failed %d time(s); Giving up for a while.",
-            cp, (int)rs->n_download_failures);
+      log_debug(LD_DIR, "%s failed %d time(s); Giving up for a while.",
+                cp, (int)rs->n_download_failures);
   });
 
   /* update_router_descriptor_downloads(time(NULL)); */
@@ -1922,13 +1930,14 @@ dir_split_resource_into_fingerprints(con
     for (i = old_len; i < smartlist_len(fp_out); ++i) {
       cp = smartlist_get(fp_out, i);
       if (strlen(cp) != HEX_DIGEST_LEN) {
-        info(LD_DIR, "Skipping digest \"%s\" with non-standard length.", cp);
+        log_info(LD_DIR,
+                 "Skipping digest \"%s\" with non-standard length.", cp);
         smartlist_del(fp_out, i--);
         goto again;
       }
       d = tor_malloc_zero(DIGEST_LEN);
       if (base16_decode(d, DIGEST_LEN, cp, HEX_DIGEST_LEN)<0) {
-        info(LD_DIR, "Skipping non-decodable digest \"%s\"", cp);
+        log_info(LD_DIR, "Skipping non-decodable digest \"%s\"", cp);
         smartlist_del(fp_out, i--);
         goto again;
       }

Index: dirserv.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.297
retrieving revision 1.298
diff -u -p -d -r1.297 -r1.298
--- dirserv.c	9 Feb 2006 05:46:49 -0000	1.297
+++ dirserv.c	13 Feb 2006 09:37:53 -0000	1.298
@@ -147,7 +147,7 @@ dirserv_add_own_fingerprint(const char *
 {
   char fp[FINGERPRINT_LEN+1];
   if (crypto_pk_get_fingerprint(pk, fp, 0)<0) {
-    err(LD_BUG, "Error computing fingerprint");
+    log_err(LD_BUG, "Error computing fingerprint");
     return -1;
   }
   if (!fingerprint_list)
@@ -173,13 +173,13 @@ dirserv_parse_fingerprint_file(const cha
 
   cf = read_file_to_str(fname, 0);
   if (!cf) {
-    warn(LD_FS, "Cannot open fingerprint file %s", fname);
+    log_warn(LD_FS, "Cannot open fingerprint file %s", fname);
     return -1;
   }
   result = config_get_lines(cf, &front);
   tor_free(cf);
   if (result < 0) {
-    warn(LD_CONFIG, "Error reading from fingerprint file");
+    log_warn(LD_CONFIG, "Error reading from fingerprint file");
     return -1;
   }
 
@@ -188,35 +188,39 @@ dirserv_parse_fingerprint_file(const cha
   for (list=front; list; list=list->next) {
     nickname = list->key; fingerprint = list->value;
     if (strlen(nickname) > MAX_NICKNAME_LEN) {
-      notice(LD_CONFIG,
-            "Nickname '%s' too long in fingerprint file. Skipping.", nickname);
+      log_notice(LD_CONFIG,
+                 "Nickname '%s' too long in fingerprint file. Skipping.",
+                 nickname);
       continue;
     }
     if (!is_legal_nickname(nickname) &&
         strcasecmp(nickname, "!reject") &&
         strcasecmp(nickname, "!invalid")) {
-      notice(LD_CONFIG,
-             "Invalid nickname '%s' in fingerprint file. Skipping.", nickname);
+      log_notice(LD_CONFIG,
+                 "Invalid nickname '%s' in fingerprint file. Skipping.",
+                 nickname);
       continue;
     }
     if (strlen(fingerprint) != FINGERPRINT_LEN ||
         !crypto_pk_check_fingerprint_syntax(fingerprint)) {
-      notice(LD_CONFIG,
-             "Invalid fingerprint (nickname '%s', fingerprint %s). Skipping.",
-             nickname, fingerprint);
+      log_notice(LD_CONFIG,
+                 "Invalid fingerprint (nickname '%s', "
+                 "fingerprint %s). Skipping.",
+                 nickname, fingerprint);
       continue;
     }
     if (0==strcasecmp(nickname, DEFAULT_CLIENT_NICKNAME)) {
       /* If you approved an OR called "client", then clients who use
        * the default nickname could all be rejected.  That's no good. */
-      notice(LD_CONFIG,
-             "Authorizing a nickname '%s' would break many clients; skipping.",
-             DEFAULT_CLIENT_NICKNAME);
+      log_notice(LD_CONFIG,
+                 "Authorizing a nickname '%s' would break "
+                 "many clients; skipping.",
+                 DEFAULT_CLIENT_NICKNAME);
       continue;
     }
     if (add_fingerprint_to_dir(nickname, fingerprint, fingerprint_list_new)
         != 0)
-      notice(LD_CONFIG, "Duplicate nickname '%s'.", nickname);
+      log_notice(LD_CONFIG, "Duplicate nickname '%s'.", nickname);
   }
 
   config_free_lines(front);
@@ -239,7 +243,7 @@ dirserv_router_get_status(const routerin
   char fingerprint[FINGERPRINT_LEN+1];
 
   if (crypto_pk_get_fingerprint(router->identity_pkey, fingerprint, 0)) {
-    warn(LD_BUG,"Error computing fingerprint");
+    log_warn(LD_BUG,"Error computing fingerprint");
     return -1;
   }
 
@@ -288,8 +292,8 @@ dirserv_get_status_impl(const char *fp, 
     fingerprint_list = smartlist_create();
 
   if (should_log)
-    debug(LD_DIRSERV, "%d fingerprints known.",
-          smartlist_len(fingerprint_list));
+    log_debug(LD_DIRSERV, "%d fingerprints known.",
+              smartlist_len(fingerprint_list));
   SMARTLIST_FOREACH(fingerprint_list, fingerprint_entry_t *, ent,
   {
     if (!strcasecmp(fp,ent->fingerprint))
@@ -318,20 +322,20 @@ dirserv_get_status_impl(const char *fp, 
 
     if (rej == ADDR_POLICY_PROBABLY_REJECTED || rej == ADDR_POLICY_REJECTED) {
       if (should_log)
-        info(LD_DIRSERV, "Rejecting '%s' because of address '%s'",
-             nickname, address);
+        log_info(LD_DIRSERV, "Rejecting '%s' because of address '%s'",
+                 nickname, address);
       if (msg)
         *msg = "Authdir is rejecting routers in this range.";
       return FP_REJECT;
     }
     if (inv == ADDR_POLICY_PROBABLY_REJECTED || inv == ADDR_POLICY_REJECTED) {
       if (should_log)
-        info(LD_DIRSERV, "Not marking '%s' valid because of address '%s'",
-             nickname, address);
+        log_info(LD_DIRSERV, "Not marking '%s' valid because of address '%s'",
+                 nickname, address);
       return FP_INVALID;
     }
     if (should_log)
-      debug(LD_DIRSERV,"No fingerprint found for '%s'",nickname);
+      log_debug(LD_DIRSERV,"No fingerprint found for '%s'",nickname);
     if (!platform || tor_version_as_new_as(platform,"0.1.0.2-rc"))
       return reject_unlisted ? FP_REJECT : FP_VALID;
     else
@@ -339,16 +343,16 @@ dirserv_get_status_impl(const char *fp, 
   }
   if (0==strcasecmp(nn_ent->fingerprint, fp)) {
     if (should_log)
-      debug(LD_DIRSERV,"Good fingerprint for '%s'",nickname);
+      log_debug(LD_DIRSERV,"Good fingerprint for '%s'",nickname);
     return FP_NAMED; /* Right fingerprint. */
   } else {
     if (should_log)
-      warn(LD_DIRSERV,
-           "Mismatched fingerprint for '%s': expected '%s' got '%s'. "
-           "ContactInfo '%s', platform '%s'.)",
-           nickname, nn_ent->fingerprint, fp,
-           contact ? contact : "",
-           platform ? platform : "");
+      log_warn(LD_DIRSERV,
+               "Mismatched fingerprint for '%s': expected '%s' got '%s'. "
+               "ContactInfo '%s', platform '%s'.)",
+               nickname, nn_ent->fingerprint, fp,
+               contact ? contact : "",
+               platform ? platform : "");
     if (msg)
       *msg = "Rejected: There is already a verified server with this nickname "
         "and a different fingerprint.";
@@ -406,14 +410,14 @@ dirserv_router_has_valid_address(routeri
   if (get_options()->DirAllowPrivateAddresses)
     return 0; /* whatever it is, we're fine with it */
   if (!tor_inet_aton(ri->address, &iaddr)) {
-    info(LD_DIRSERV,"Router '%s' published non-IP address '%s'. Refusing.",
-         ri->nickname, ri->address);
+    log_info(LD_DIRSERV,"Router '%s' published non-IP address '%s'. Refusing.",
+             ri->nickname, ri->address);
     return -1;
   }
   if (is_internal_IP(ntohl(iaddr.s_addr), 0)) {
-    info(LD_DIRSERV,
-         "Router '%s' published internal IP address '%s'. Refusing.",
-         ri->nickname, ri->address);
+    log_info(LD_DIRSERV,
+             "Router '%s' published internal IP address '%s'. Refusing.",
+             ri->nickname, ri->address);
     return -1; /* it's a private IP, we should reject it */
   }
   return 0;
@@ -514,7 +518,7 @@ dirserv_add_descriptor(const char *desc,
   /* Check: is the descriptor syntactically valid? */
   ri = router_parse_entry_from_string(desc, NULL);
   if (!ri) {
-    warn(LD_DIRSERV, "Couldn't parse uploaded server descriptor");
+    log_warn(LD_DIRSERV, "Couldn't parse uploaded server descriptor");
     *msg = "Rejected: Couldn't parse server descriptor.";
     return -2;
   }
@@ -526,9 +530,9 @@ dirserv_add_descriptor(const char *desc,
   if (ri_old && ri_old->cache_info.published_on < ri->cache_info.published_on
       && router_differences_are_cosmetic(ri_old, ri)
       && !router_is_me(ri)) {
-    info(LD_DIRSERV,
-         "Not replacing descriptor from '%s'; differences are cosmetic.",
-         ri->nickname);
+    log_info(LD_DIRSERV,
+             "Not replacing descriptor from '%s'; differences are cosmetic.",
+             ri->nickname);
     *msg = "Not replacing router descriptor; no information has changed since "
       "the last one with this identity.";
     routerinfo_free(ri);
@@ -572,22 +576,22 @@ directory_remove_invalid(void)
     router_status_t r = dirserv_router_get_status(ent, &msg);
     switch (r) {
       case FP_REJECT:
-        info(LD_DIRSERV, "Router '%s' is now rejected: %s",
-             ent->nickname, msg?msg:"");
+        log_info(LD_DIRSERV, "Router '%s' is now rejected: %s",
+                 ent->nickname, msg?msg:"");
         routerlist_remove(rl, ent, i--, 0);
         changed = 1;
         break;
       case FP_NAMED:
         if (!ent->is_verified || !ent->is_named) {
-          info(LD_DIRSERV,
-               "Router '%s' is now verified and named.", ent->nickname);
+          log_info(LD_DIRSERV,
+                   "Router '%s' is now verified and named.", ent->nickname);
           ent->is_verified = ent->is_named = 1;
           changed = 1;
         }
         break;
       case FP_VALID:
         if (!ent->is_verified || ent->is_named) {
-          info(LD_DIRSERV, "Router '%s' is now verified.", ent->nickname);
+          log_info(LD_DIRSERV, "Router '%s' is now verified.", ent->nickname);
           ent->is_verified = 1;
           ent->is_named = 0;
           changed = 1;
@@ -595,8 +599,8 @@ directory_remove_invalid(void)
         break;
       case FP_INVALID:
         if (ent->is_verified || ent->is_named) {
-          info(LD_DIRSERV,
-               "Router '%s' is no longer verified.", ent->nickname);
+          log_info(LD_DIRSERV,
+                   "Router '%s' is no longer verified.", ent->nickname);
           ent->is_verified = ent->is_named = 0;
           changed = 1;
         }
@@ -812,7 +816,7 @@ dirserv_dump_directory_to_string(char **
 
   if (crypto_pk_write_public_key_to_string(private_key,&identity_pkey,
                                            &identity_pkey_len)<0) {
-    warn(LD_BUG,"write identity_pkey to string failed!");
+    log_warn(LD_BUG,"write identity_pkey to string failed!");
     return -1;
   }
 
@@ -870,7 +874,7 @@ dirserv_dump_directory_to_string(char **
     goto truncated;
 
   if (router_get_dir_hash(buf,digest)) {
-    warn(LD_BUG,"couldn't compute digest");
+    log_warn(LD_BUG,"couldn't compute digest");
     tor_free(buf);
     return -1;
   }
@@ -882,7 +886,7 @@ dirserv_dump_directory_to_string(char **
   *dir_out = buf;
   return 0;
  truncated:
-  warn(LD_BUG,"tried to exceed string length.");
+  log_warn(LD_BUG,"tried to exceed string length.");
   tor_free(buf);
   return -1;
 }
@@ -910,21 +914,21 @@ set_cached_dir(cached_dir_t *d, char *di
 {
   time_t now = time(NULL);
   if (when<=d->published) {
-    info(LD_DIRSERV, "Ignoring old directory; not caching.");
+    log_info(LD_DIRSERV, "Ignoring old directory; not caching.");
     tor_free(directory);
   } else if (when>=now+ROUTER_MAX_AGE) {
-    info(LD_DIRSERV, "Ignoring future directory; not caching.");
+    log_info(LD_DIRSERV, "Ignoring future directory; not caching.");
     tor_free(directory);
   } else {
     /* if (when>d->published && when<now+ROUTER_MAX_AGE) */
-    debug(LD_DIRSERV, "Caching directory.");
+    log_debug(LD_DIRSERV, "Caching directory.");
     tor_free(d->dir);
     d->dir = directory;
     d->dir_len = strlen(directory);
     tor_free(d->dir_z);
     if (tor_gzip_compress(&(d->dir_z), &(d->dir_z_len), d->dir, d->dir_len,
                           ZLIB_METHOD)) {
-      warn(LD_BUG,"Error compressing cached directory");
+      log_warn(LD_BUG,"Error compressing cached directory");
     }
     d->published = when;
   }
@@ -1043,11 +1047,11 @@ dirserv_pick_cached_dir_obj(cached_dir_t
     if (regenerate != NULL) {
       if (dirty && dirty + DIR_REGEN_SLACK_TIME < time(NULL)) {
         if (regenerate()) {
-          err(LD_BUG, "Couldn't generate %s?", name);
+          log_err(LD_BUG, "Couldn't generate %s?", name);
           exit(1);
         }
       } else {
-        info(LD_DIRSERV, "The %s is still clean; reusing.", name);
+        log_info(LD_DIRSERV, "The %s is still clean; reusing.", name);
       }
     }
     return auth_src ? auth_src : cache_src;
@@ -1111,15 +1115,15 @@ dirserv_regenerate_directory(void)
 
   if (dirserv_dump_directory_to_string(&new_directory,
                                        get_identity_key())) {
-    warn(LD_BUG, "Error creating directory.");
+    log_warn(LD_BUG, "Error creating directory.");
     tor_free(new_directory);
     return -1;
   }
   set_cached_dir(&the_directory, new_directory, time(NULL));
-  info(LD_DIRSERV,"New directory (size %d) has been built.",
-       (int)the_directory.dir_len);
-  debug(LD_DIRSERV,"New directory (size %d):\n%s",(int)the_directory.dir_len,
-        the_directory.dir);
+  log_info(LD_DIRSERV,"New directory (size %d) has been built.",
+           (int)the_directory.dir_len);
+  log_debug(LD_DIRSERV,"New directory (size %d):\n%s",
+            (int)the_directory.dir_len, the_directory.dir);
 
   the_directory_is_dirty = 0;
 
@@ -1152,7 +1156,7 @@ generate_runningrouters(void)
   }
   if (crypto_pk_write_public_key_to_string(private_key,&identity_pkey,
                                            &identity_pkey_len)<0) {
-    warn(LD_BUG,"write identity_pkey to string failed!");
+    log_warn(LD_BUG,"write identity_pkey to string failed!");
     goto err;
   }
   format_iso_time(published, time(NULL));
@@ -1170,7 +1174,7 @@ generate_runningrouters(void)
   tor_free(router_status);
   tor_free(identity_pkey);
   if (router_get_runningrouters_hash(s,digest)) {
-    warn(LD_BUG,"couldn't compute digest");
+    log_warn(LD_BUG,"couldn't compute digest");
     goto err;
   }
   if (router_append_dirobj_signature(s, len, digest, private_key)<0)
@@ -1286,7 +1290,7 @@ dirserv_compute_stable_uptime(routerlist
   stable_uptime = *(long *)smartlist_get(uptimes,
                                          smartlist_len(uptimes)/2);
 
-  info(LD_DIRSERV, "Uptime cutoff is %ld seconds.", stable_uptime);
+  log_info(LD_DIRSERV, "Uptime cutoff is %ld seconds.", stable_uptime);
 
   SMARTLIST_FOREACH(uptimes, long *, up, tor_free(up));
   smartlist_free(uptimes);
@@ -1328,7 +1332,7 @@ generate_v2_networkstatus(void)
   const char *contact;
 
   if (resolve_my_address(options, &addr, &hostname)<0) {
-    warn(LD_NET, "Couldn't resolve my hostname");
+    log_warn(LD_NET, "Couldn't resolve my hostname");
     goto done;
   }
   in.s_addr = htonl(addr);
@@ -1341,12 +1345,12 @@ generate_v2_networkstatus(void)
 
   if (crypto_pk_write_public_key_to_string(private_key, &identity_pkey,
                                            &identity_pkey_len)<0) {
-    warn(LD_BUG,"Writing public key to string failed.");
+    log_warn(LD_BUG,"Writing public key to string failed.");
     goto done;
   }
 
   if (crypto_pk_get_fingerprint(private_key, fingerprint, 0)<0) {
-    err(LD_BUG, "Error computing fingerprint");
+    log_err(LD_BUG, "Error computing fingerprint");
     goto done;
   }
 
@@ -1436,7 +1440,7 @@ generate_v2_networkstatus(void)
                        f_running?" Running":"",
                        f_valid?" Valid":"",
                        f_v2_dir?" V2Dir":"")<0) {
-        warn(LD_BUG, "Unable to print router status.");
+        log_warn(LD_BUG, "Unable to print router status.");
         goto done;
       }
       outp += strlen(outp);
@@ -1445,17 +1449,17 @@ generate_v2_networkstatus(void)
 
   if (tor_snprintf(outp, endp-outp, "directory-signature %s\n",
                    get_options()->Nickname)<0) {
-    warn(LD_BUG, "Unable to write signature line.");
+    log_warn(LD_BUG, "Unable to write signature line.");
     goto done;
   }
 
   if (router_get_networkstatus_v2_hash(status, digest)<0) {
-    warn(LD_BUG, "Unable to hash network status");
+    log_warn(LD_BUG, "Unable to hash network status");
     goto done;
   }
 
   if (router_append_dirobj_signature(outp,endp-outp,digest,private_key)<0) {
-    warn(LD_BUG, "Unable to sign router status.");
+    log_warn(LD_BUG, "Unable to sign router status.");
     goto done;
   }
 
@@ -1503,7 +1507,8 @@ dirserv_get_networkstatus_v2(smartlist_t
       if (d)
         smartlist_add(result, d);
       else
-        warn(LD_BUG,"Unable to generate an authoritative network status.");
+        log_warn(LD_BUG,
+                 "Unable to generate an authoritative network status.");
     }
   } else if (!strcmp(key, "all")) {
     digestmap_iter_t *iter;
@@ -1518,8 +1523,8 @@ dirserv_get_networkstatus_v2(smartlist_t
       iter = digestmap_iter_next(cached_v2_networkstatus, iter);
     }
     if (smartlist_len(result) == 0)
-      warn(LD_DIRSERV,
-           "Client requested 'all' network status objects; we have none.");
+      log_warn(LD_DIRSERV,
+               "Client requested 'all' network status objects; we have none.");
   } else if (!strcmpstart(key, "fp/")) {
     smartlist_t *digests = smartlist_create();
     dir_split_resource_into_fingerprints(key+3, digests, NULL, 1);
@@ -1534,8 +1539,8 @@ dirserv_get_networkstatus_v2(smartlist_t
           } else {
             char hexbuf[HEX_DIGEST_LEN+1];
             base16_encode(hexbuf, sizeof(hexbuf), cp, DIGEST_LEN);
-            info(LD_DIRSERV, "Don't know about any network status with "
-                 "fingerprint '%s'", hexbuf);
+            log_info(LD_DIRSERV, "Don't know about any network status with "
+                     "fingerprint '%s'", hexbuf);
           }
           tor_free(cp);
         });
@@ -1651,15 +1656,17 @@ dirserv_orconn_tls_done(const char *addr
     if (!ri->is_verified) {
       /* We have a router at the same address! */
       if (strcasecmp(ri->nickname, nickname_rcvd)) {
-        notice(LD_DIRSERV, "Dropping descriptor: nickname '%s' does not match "
-               "nickname '%s' in cert from %s:%d",
-               ri->nickname, nickname_rcvd, address, or_port);
+        log_notice(LD_DIRSERV,
+                   "Dropping descriptor: nickname '%s' does not match "
+                   "nickname '%s' in cert from %s:%d",
+                   ri->nickname, nickname_rcvd, address, or_port);
         drop = 1;
       } else if (memcmp(ri->cache_info.identity_digest, digest_rcvd,
                         DIGEST_LEN)) {
-        notice(LD_DIRSERV, "Dropping descriptor: identity key does not match "
-               "key in cert from %s:%d",
-               address, or_port);
+        log_notice(LD_DIRSERV,
+                   "Dropping descriptor: identity key does not match "
+                   "key in cert from %s:%d",
+                   address, or_port);
         drop = 1;
       }
     }
@@ -1667,7 +1674,8 @@ dirserv_orconn_tls_done(const char *addr
       routerlist_remove(rl, ri, i--, 0);
       directory_set_dirty();
     } else { /* correct nickname and digest. mark this router reachable! */
-      info(LD_DIRSERV,"Found router %s to be reachable. Yay.", ri->nickname);
+      log_info(LD_DIRSERV, "Found router %s to be reachable. Yay.",
+               ri->nickname);
       ri->last_reachable = time(NULL);
       ri->num_unreachable_notifications = 0;
     }

Index: dns.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -p -d -r1.180 -r1.181
--- dns.c	9 Feb 2006 05:46:49 -0000	1.180
+++ dns.c	13 Feb 2006 09:37:53 -0000	1.181
@@ -160,15 +160,18 @@ purge_expired_resolves(uint32_t now)
    */
   while (oldest_cached_resolve && (oldest_cached_resolve->expire < now)) {
     resolve = oldest_cached_resolve;
-    debug(LD_EXIT,"Forgetting old cached resolve (address %s, expires %lu)",
-          safe_str(resolve->address), (unsigned long)resolve->expire);
+    log_debug(LD_EXIT,
+              "Forgetting old cached resolve (address %s, expires %lu)",
+              safe_str(resolve->address), (unsigned long)resolve->expire);
     if (resolve->state == CACHE_STATE_PENDING) {
-      debug(LD_EXIT,"Bug: Expiring a dns resolve ('%s') that's still pending."
-            " Forgot to cull it?", safe_str(resolve->address));
+      log_debug(LD_EXIT,
+                "Bug: Expiring a dns resolve ('%s') that's still pending."
+                " Forgot to cull it?", safe_str(resolve->address));
       tor_fragile_assert();
     }
     if (resolve->pending_connections) {
-      debug(LD_EXIT, "Closing pending connections on expiring DNS resolve!");
+      log_debug(LD_EXIT,
+                "Closing pending connections on expiring DNS resolve!");
       tor_fragile_assert();
       while (resolve->pending_connections) {
         pend = resolve->pending_connections;
@@ -296,21 +299,21 @@ dns_resolve(connection_t *exitconn)
         pending_connection->conn = exitconn;
         pending_connection->next = resolve->pending_connections;
         resolve->pending_connections = pending_connection;
-        debug(LD_EXIT,"Connection (fd %d) waiting for pending DNS "
-              "resolve of '%s'",
-              exitconn->s, safe_str(exitconn->address));
+        log_debug(LD_EXIT,"Connection (fd %d) waiting for pending DNS "
+                  "resolve of '%s'",
+                  exitconn->s, safe_str(exitconn->address));
         exitconn->state = EXIT_CONN_STATE_RESOLVING;
         return 0;
       case CACHE_STATE_VALID:
         exitconn->addr = resolve->addr;
-        debug(LD_EXIT,"Connection (fd %d) found cached answer for '%s'",
-              exitconn->s, safe_str(exitconn->address));
+        log_debug(LD_EXIT,"Connection (fd %d) found cached answer for '%s'",
+                  exitconn->s, safe_str(exitconn->address));
         if (exitconn->purpose == EXIT_PURPOSE_RESOLVE)
           send_resolved_cell(exitconn, RESOLVED_TYPE_IPV4);
         return 1;
       case CACHE_STATE_FAILED:
-        debug(LD_EXIT,"Connection (fd %d) found cached error for '%s'",
-              exitconn->s, safe_str(exitconn->address));
+        log_debug(LD_EXIT,"Connection (fd %d) found cached error for '%s'",
+                  exitconn->s, safe_str(exitconn->address));
         if (exitconn->purpose == EXIT_PURPOSE_RESOLVE)
           send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
         circ = circuit_get_by_edge_conn(exitconn);
@@ -359,16 +362,16 @@ assign_to_dnsworker(connection_t *exitco
                                          DNSWORKER_STATE_IDLE);
 
   if (!dnsconn) {
-    warn(LD_EXIT,"no idle dns workers. Failing.");
+    log_warn(LD_EXIT,"no idle dns workers. Failing.");
     if (exitconn->purpose == EXIT_PURPOSE_RESOLVE)
       send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR_TRANSIENT);
     goto err;
   }
 
-  debug(LD_EXIT,
-        "Connection (fd %d) needs to resolve '%s'; assigning "
-        "to DNSWorker (fd %d)",
-        exitconn->s, safe_str(exitconn->address), dnsconn->s);
+  log_debug(LD_EXIT,
+            "Connection (fd %d) needs to resolve '%s'; assigning "
+            "to DNSWorker (fd %d)",
+            exitconn->s, safe_str(exitconn->address), dnsconn->s);
 
   tor_free(dnsconn->address);
   dnsconn->address = tor_strdup(exitconn->address);
@@ -402,8 +405,8 @@ connection_dns_remove(connection_t *conn
   resolve = HT_FIND(cache_map, &cache_root, &search);
   if (!resolve) {
     /* XXXX RD This *is* a bug, right? -NM */
-    notice(LD_BUG, "Address '%s' is not pending. Dropping.",
-           safe_str(conn->address));
+    log_notice(LD_BUG, "Address '%s' is not pending. Dropping.",
+               safe_str(conn->address));
     return;
   }
 
@@ -415,9 +418,9 @@ connection_dns_remove(connection_t *conn
   if (pend->conn == conn) {
     resolve->pending_connections = pend->next;
     tor_free(pend);
-    debug(LD_EXIT, "First connection (fd %d) no longer waiting for resolve "
-          "of '%s'",
-          conn->s, safe_str(conn->address));
+    log_debug(LD_EXIT, "First connection (fd %d) no longer waiting "
+              "for resolve of '%s'",
+              conn->s, safe_str(conn->address));
     return;
   } else {
     for ( ; pend->next; pend = pend->next) {
@@ -425,9 +428,9 @@ connection_dns_remove(connection_t *conn
         victim = pend->next;
         pend->next = victim->next;
         tor_free(victim);
-        debug(LD_EXIT, "Connection (fd %d) no longer waiting for resolve "
-              "of '%s'",
-              conn->s, safe_str(conn->address));
+        log_debug(LD_EXIT,
+                  "Connection (fd %d) no longer waiting for resolve of '%s'",
+                  conn->s, safe_str(conn->address));
         return; /* more are pending */
       }
     }
@@ -489,22 +492,25 @@ dns_cancel_pending_resolve(char *address
   resolve = HT_FIND(cache_map, &cache_root, &search);
   if (!resolve) {
     /* XXXX RD This *is* a bug, right? -NM */
-    notice(LD_BUG,"Address '%s' is not pending. Dropping.", safe_str(address));
+    log_notice(LD_BUG,"Address '%s' is not pending. Dropping.",
+               safe_str(address));
     return;
   }
 
   if (!resolve->pending_connections) {
     /* XXX this should never trigger, but sometimes it does */
-    warn(LD_BUG,"Bug: Address '%s' is pending but has no pending connections!",
-         safe_str(address));
+    log_warn(LD_BUG,
+             "Bug: Address '%s' is pending but has no pending connections!",
+             safe_str(address));
     tor_fragile_assert();
     return;
   }
   tor_assert(resolve->pending_connections);
 
   /* mark all pending connections to fail */
-  debug(LD_EXIT, "Failing all connections waiting on DNS resolve of '%s'",
-        safe_str(address));
+  log_debug(LD_EXIT,
+             "Failing all connections waiting on DNS resolve of '%s'",
+             safe_str(address));
   while (resolve->pending_connections) {
     pend = resolve->pending_connections;
     pend->conn->state = EXIT_CONN_STATE_RESOLVEFAILED;
@@ -575,8 +581,8 @@ dns_found_answer(char *address, uint32_t
 
   resolve = HT_FIND(cache_map, &cache_root, &search);
   if (!resolve) {
-    info(LD_EXIT,"Resolved unasked address '%s'; caching anyway.",
-         safe_str(address));
+    log_info(LD_EXIT,"Resolved unasked address '%s'; caching anyway.",
+             safe_str(address));
     resolve = tor_malloc_zero(sizeof(cached_resolve_t));
     resolve->state = (outcome == DNS_RESOLVE_SUCCEEDED) ?
       CACHE_STATE_VALID : CACHE_STATE_FAILED;
@@ -589,8 +595,8 @@ dns_found_answer(char *address, uint32_t
   if (resolve->state != CACHE_STATE_PENDING) {
     /* XXXX Maybe update addr? or check addr for consistency? Or let
      * VALID replace FAILED? */
-    notice(LD_EXIT, "Resolved '%s' which was already resolved; ignoring",
-           safe_str(address));
+    log_notice(LD_EXIT, "Resolved '%s' which was already resolved; ignoring",
+               safe_str(address));
     tor_assert(resolve->pending_connections == NULL);
     return;
   }
@@ -681,7 +687,7 @@ connection_dns_finished_flushing(connect
 int
 connection_dns_reached_eof(connection_t *conn)
 {
-  warn(LD_EXIT,"Read eof. Worker died unexpectedly.");
+  log_warn(LD_EXIT,"Read eof. Worker died unexpectedly.");
   if (conn->state == DNSWORKER_STATE_BUSY) {
     /* don't cancel the resolve here -- it would be cancelled in
      * connection_about_to_close_connection(), since conn is still
@@ -707,9 +713,10 @@ connection_dns_process_inbuf(connection_
   tor_assert(conn->type == CONN_TYPE_DNSWORKER);
 
   if (conn->state != DNSWORKER_STATE_BUSY && buf_datalen(conn->inbuf)) {
-    warn(LD_BUG,"Bug: read data (%d bytes) from an idle dns worker (fd %d, "
-         "address '%s'). Please report.",
-         (int)buf_datalen(conn->inbuf), conn->s, safe_str(conn->address));
+    log_warn(LD_BUG,
+             "Bug: read data (%d bytes) from an idle dns worker (fd %d, "
+             "address '%s'). Please report.",
+             (int)buf_datalen(conn->inbuf), conn->s, safe_str(conn->address));
     tor_fragile_assert();
 
     /* Pull it off the buffer anyway, or it will just stay there.
@@ -718,8 +725,8 @@ connection_dns_process_inbuf(connection_
     while (buf_datalen(conn->inbuf)) {
       connection_fetch_from_buf(&success,1,conn);
       connection_fetch_from_buf((char *)&addr,sizeof(uint32_t),conn);
-      warn(LD_EXIT,"Discarding idle dns answer (success %d, addr %d.)",
-           success, addr); // XXX safe_str
+      log_warn(LD_EXIT,"Discarding idle dns answer (success %d, addr %d.)",
+               success, addr); // XXX safe_str
     }
     return 0;
   }
@@ -731,8 +738,8 @@ connection_dns_process_inbuf(connection_
   connection_fetch_from_buf(&success,1,conn);
   connection_fetch_from_buf((char *)&addr,sizeof(uint32_t),conn);
 
-  debug(LD_EXIT, "DNSWorker (fd %d) returned answer for '%s'",
-        conn->s, safe_str(conn->address));
+  log_debug(LD_EXIT, "DNSWorker (fd %d) returned answer for '%s'",
+            conn->s, safe_str(conn->address));
 
   tor_assert(success >= DNS_RESOLVE_FAILED_TRANSIENT);
   tor_assert(success <= DNS_RESOLVE_SUCCEEDED);
@@ -812,13 +819,13 @@ dnsworker_main(void *data)
 
     if ((r = recv(fd, &address_len, 1, 0)) != 1) {
       if (r == 0) {
-        info(LD_EXIT,"DNS worker exiting because Tor process closed "
-             "connection (either pruned idle dnsworker or died).");
+        log_info(LD_EXIT,"DNS worker exiting because Tor process closed "
+                 "connection (either pruned idle dnsworker or died).");
       } else {
-        info(LD_EXIT,"DNS worker exiting because of error on connection "
-             "to Tor process.");
-        info(LD_EXIT,"(Error on %d was %s)", fd,
-             tor_socket_strerror(tor_socket_errno(fd)));
+        log_info(LD_EXIT,"DNS worker exiting because of error on connection "
+                 "to Tor process.");
+        log_info(LD_EXIT,"(Error on %d was %s)", fd,
+                 tor_socket_strerror(tor_socket_errno(fd)));
       }
       tor_close_socket(fd);
       crypto_thread_cleanup();
@@ -826,7 +833,7 @@ dnsworker_main(void *data)
     }
 
     if (address_len && read_all(fd, address, address_len, 1) != address_len) {
-      err(LD_BUG,"read hostname failed. Child exiting.");
+      log_err(LD_BUG,"read hostname failed. Child exiting.");
       tor_close_socket(fd);
       crypto_thread_cleanup();
       spawn_exit();
@@ -840,23 +847,23 @@ dnsworker_main(void *data)
     switch (result) {
       case 1:
         /* XXX result can never be 1, because we set it to -1 above on error */
-        info(LD_NET,"Could not resolve dest addr %s (transient).",
-             safe_str(address));
+        log_info(LD_NET,"Could not resolve dest addr %s (transient).",
+                 safe_str(address));
         answer[0] = DNS_RESOLVE_FAILED_TRANSIENT;
         break;
       case -1:
-        info(LD_NET,"Could not resolve dest addr %s (permanent).",
-             safe_str(address));
+        log_info(LD_NET,"Could not resolve dest addr %s (permanent).",
+                 safe_str(address));
         answer[0] = DNS_RESOLVE_FAILED_PERMANENT;
         break;
       case 0:
-        info(LD_NET,"Resolved address '%s'.",safe_str(address));
+        log_info(LD_NET,"Resolved address '%s'.",safe_str(address));
         answer[0] = DNS_RESOLVE_SUCCEEDED;
         break;
     }
     set_uint32(answer+1, ip);
     if (write_all(fd, answer, 5, 1) != 5) {
-      err(LD_NET,"writing answer failed. Child exiting.");
+      log_err(LD_NET,"writing answer failed. Child exiting.");
       tor_close_socket(fd);
       crypto_thread_cleanup();
       spawn_exit();
@@ -877,8 +884,8 @@ spawn_dnsworker(void)
 
   fdarray = tor_malloc(sizeof(int)*2);
   if ((err = tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fdarray)) < 0) {
-    warn(LD_NET, "Couldn't construct socketpair: %s",
-         tor_socket_strerror(-err));
+    log_warn(LD_NET, "Couldn't construct socketpair: %s",
+             tor_socket_strerror(-err));
     tor_free(fdarray);
     return -1;
   }
@@ -889,7 +896,7 @@ spawn_dnsworker(void)
   fd = fdarray[0]; /* We copy this out here, since dnsworker_main may free
                     * fdarray */
   spawn_func(dnsworker_main, (void*)fdarray);
-  debug(LD_EXIT,"just spawned a dns worker.");
+  log_debug(LD_EXIT,"just spawned a dns worker.");
 #ifndef TOR_IS_MULTITHREADED
   tor_close_socket(fdarray[1]); /* don't need the worker's side of the pipe */
   tor_free(fdarray);
@@ -904,7 +911,7 @@ spawn_dnsworker(void)
   conn->address = tor_strdup("<unused>");
 
   if (connection_add(conn) < 0) { /* no space, forget it */
-    warn(LD_NET,"connection_add failed. Giving up.");
+    log_warn(LD_NET,"connection_add failed. Giving up.");
     connection_free(conn); /* this closes fd */
     return -1;
   }
@@ -943,8 +950,8 @@ spawn_enough_dnsworkers(void)
                                                        DNSWORKER_STATE_BUSY);
     tor_assert(dnsconn);
 
-    warn(LD_EXIT, "%d DNS workers are spawned; all are busy. Killing one.",
-         MAX_DNSWORKERS);
+    log_warn(LD_EXIT, "%d DNS workers are spawned; all are busy. Killing one.",
+             MAX_DNSWORKERS);
 
     connection_mark_for_close(dnsconn);
     num_dnsworkers_busy--;
@@ -958,7 +965,7 @@ spawn_enough_dnsworkers(void)
 
   while (num_dnsworkers < num_dnsworkers_needed) {
     if (spawn_dnsworker() < 0) {
-      warn(LD_EXIT,"Spawn failed. Will try again later.");
+      log_warn(LD_EXIT,"Spawn failed. Will try again later.");
       return -1;
     }
     num_dnsworkers++;
@@ -967,8 +974,8 @@ spawn_enough_dnsworkers(void)
   while (num_dnsworkers > num_dnsworkers_busy+MAX_IDLE_DNSWORKERS) {
     /* too many idle? */
     /* cull excess workers */
-    info(LD_EXIT,"%d of %d dnsworkers are idle. Killing one.",
-         num_dnsworkers-num_dnsworkers_busy, num_dnsworkers);
+    log_info(LD_EXIT,"%d of %d dnsworkers are idle. Killing one.",
+             num_dnsworkers-num_dnsworkers_busy, num_dnsworkers);
     dnsconn = connection_get_by_type_state(CONN_TYPE_DNSWORKER,
                                            DNSWORKER_STATE_IDLE);
     tor_assert(dnsconn);

Index: hibernate.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/hibernate.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -p -d -r1.67 -r1.68
--- hibernate.c	9 Feb 2006 05:46:49 -0000	1.67
+++ hibernate.c	13 Feb 2006 09:37:53 -0000	1.68
@@ -129,7 +129,7 @@ accounting_parse_options(or_options_t *o
   smartlist_split_string(items, v, NULL,
                          SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK,0);
   if (smartlist_len(items)<2) {
-    warn(LD_CONFIG, "Too few arguments to AccountingStart");
+    log_warn(LD_CONFIG, "Too few arguments to AccountingStart");
     goto err;
   }
   s = smartlist_get(items,0);
@@ -140,8 +140,9 @@ accounting_parse_options(or_options_t *o
   } else if (0==strcasecmp(s, "day")) {
     unit = UNIT_DAY;
   } else {
-    warn(LD_CONFIG, "Unrecognized accounting unit '%s': only 'month', 'week',"
-         " and 'day' are supported.", s);
+    log_warn(LD_CONFIG,
+             "Unrecognized accounting unit '%s': only 'month', 'week',"
+             " and 'day' are supported.", s);
     goto err;
   }
 
@@ -149,16 +150,16 @@ accounting_parse_options(or_options_t *o
   case UNIT_WEEK:
     d = tor_parse_long(smartlist_get(items,1), 10, 1, 7, &ok, NULL);
     if (!ok) {
-      warn(LD_CONFIG, "Weekly accounting must begin on a day between "
-           "1 (Monday) and 7 (Sunday)");
+      log_warn(LD_CONFIG, "Weekly accounting must begin on a day between "
+               "1 (Monday) and 7 (Sunday)");
       goto err;
     }
     break;
   case UNIT_MONTH:
     d = tor_parse_long(smartlist_get(items,1), 10, 1, 28, &ok, NULL);
     if (!ok) {
-      warn(LD_CONFIG, "Monthly accounting must begin on a day between "
-           "1 and 28");
+      log_warn(LD_CONFIG, "Monthly accounting must begin on a day between "
+               "1 and 28");
       goto err;
     }
     break;
@@ -171,27 +172,29 @@ accounting_parse_options(or_options_t *o
 
   idx = unit==UNIT_DAY?1:2;
   if (smartlist_len(items) != (idx+1)) {
-    warn(LD_CONFIG,"Accounting unit '%s' requires %d argument%s.",
-         s, idx, (idx>1)?"s":"");
+    log_warn(LD_CONFIG,"Accounting unit '%s' requires %d argument%s.",
+             s, idx, (idx>1)?"s":"");
     goto err;
   }
   s = smartlist_get(items, idx);
   h = tor_parse_long(s, 10, 0, 23, &ok, &cp);
   if (!ok) {
-    warn(LD_CONFIG,"Accounting start time not parseable: bad hour.");
+    log_warn(LD_CONFIG,"Accounting start time not parseable: bad hour.");
     goto err;
   }
   if (!cp || *cp!=':') {
-    warn(LD_CONFIG,"Accounting start time not parseable: not in HH:MM format");
+    log_warn(LD_CONFIG,
+             "Accounting start time not parseable: not in HH:MM format");
     goto err;
   }
   m = tor_parse_long(cp+1, 10, 0, 59, &ok, &cp);
   if (!ok) {
-    warn(LD_CONFIG, "Accounting start time not parseable: bad minute");
+    log_warn(LD_CONFIG, "Accounting start time not parseable: bad minute");
     goto err;
   }
   if (!cp || *cp!='\0') {
-    warn(LD_CONFIG,"Accounting start time not parseable: not in HH:MM format");
+    log_warn(LD_CONFIG,
+             "Accounting start time not parseable: not in HH:MM format");
     goto err;
   }
 
@@ -325,15 +328,16 @@ configure_accounting(time_t now)
       start_of_accounting_period_after(interval_start_time) <= now) {
     /* We didn't have recorded usage, or we don't have recorded usage
      * for this interval. Start a new interval. */
-    info(LD_ACCT, "Starting new accounting interval.");
+    log_info(LD_ACCT, "Starting new accounting interval.");
     reset_accounting(now);
   } else if (interval_start_time ==
         start_of_accounting_period_containing(interval_start_time)) {
-    info(LD_ACCT, "Continuing accounting interval.");
+    log_info(LD_ACCT, "Continuing accounting interval.");
     /* We are in the interval we thought we were in. Do nothing.*/
     interval_end_time = start_of_accounting_period_after(interval_start_time);
   } else {
-    warn(LD_ACCT, "Mismatched accounting interval; starting a fresh one.");
+    log_warn(LD_ACCT,
+             "Mismatched accounting interval; starting a fresh one.");
     reset_accounting(now);
   }
   accounting_set_wakeup_time();
@@ -374,7 +378,7 @@ update_expected_bandwidth(void)
 static void
 reset_accounting(time_t now)
 {
-  info(LD_ACCT, "Starting new accounting interval.");
+  log_info(LD_ACCT, "Starting new accounting interval.");
   update_expected_bandwidth();
   interval_start_time = start_of_accounting_period_containing(now);
   interval_end_time = start_of_accounting_period_after(interval_start_time);
@@ -417,7 +421,7 @@ accounting_run_housekeeping(time_t now)
   }
   if (time_to_record_bandwidth_usage(now)) {
     if (accounting_record_bandwidth_usage(now)) {
-      err(LD_FS, "Couldn't record bandwidth usage to disk; exiting.");
+      log_err(LD_FS, "Couldn't record bandwidth usage to disk; exiting.");
       /* This can fail when we're out of fd's, causing a crash.
        * The current answer is to reserve 32 more than we need, in
        * set_max_file_descriptors(). */
@@ -440,7 +444,7 @@ accounting_set_wakeup_time(void)
 
   if (! identity_key_is_set()) {
     if (init_keys() < 0) {
-      err(LD_BUG, "Error initializing keys");
+      log_err(LD_BUG, "Error initializing keys");
       tor_assert(0);
     }
   }
@@ -462,7 +466,8 @@ accounting_set_wakeup_time(void)
     time_to_exhaust_bw = 24*60*60;
     interval_wakeup_time = interval_start_time;
 
-    notice(LD_ACCT, "Configured hibernation.  This interval begins at %s "
+    log_notice(LD_ACCT,
+           "Configured hibernation.  This interval begins at %s "
            "and ends at %s.  We have no prior estimate for bandwidth, so "
            "we will start out awake and hibernate when we exhaust our quota.",
            buf1, buf2);
@@ -504,7 +509,8 @@ accounting_set_wakeup_time(void)
                    down_time<interval_end_time?down_time:interval_end_time);
     format_local_iso_time(buf4, interval_end_time);
 
-    notice(LD_ACCT, "Configured hibernation.  This interval began at %s; "
+    log_notice(LD_ACCT,
+           "Configured hibernation.  This interval began at %s; "
            "the scheduled wake-up time %s %s; "
            "we expect%s to exhaust our quota for this interval around %s; "
            "the next interval begins at %s (all times local)",
@@ -570,45 +576,45 @@ read_bandwidth_usage(void)
 
   if (smartlist_len(elts)<1 ||
       atoi(smartlist_get(elts,0)) != BW_ACCOUNTING_VERSION) {
-    warn(LD_ACCT, "Unrecognized bw_accounting file version: %s",
-         (const char*)smartlist_get(elts,0));
+    log_warn(LD_ACCT, "Unrecognized bw_accounting file version: %s",
+             (const char*)smartlist_get(elts,0));
     goto err;
   }
   if (smartlist_len(elts) < 7) {
-    warn(LD_ACCT, "Corrupted bw_accounting file: %d lines",
-         smartlist_len(elts));
+    log_warn(LD_ACCT, "Corrupted bw_accounting file: %d lines",
+             smartlist_len(elts));
     goto err;
   }
   if (parse_iso_time(smartlist_get(elts,1), &t1)) {
-    warn(LD_ACCT, "Error parsing bandwidth usage start time.");
+    log_warn(LD_ACCT, "Error parsing bandwidth usage start time.");
     goto err;
   }
   if (parse_iso_time(smartlist_get(elts,2), &t2)) {
-    warn(LD_ACCT, "Error parsing bandwidth usage last-written time");
+    log_warn(LD_ACCT, "Error parsing bandwidth usage last-written time");
     goto err;
   }
   n_read = tor_parse_uint64(smartlist_get(elts,3), 10, 0, UINT64_MAX,
                             &ok, NULL);
   if (!ok) {
-    warn(LD_ACCT, "Error parsing number of bytes read");
+    log_warn(LD_ACCT, "Error parsing number of bytes read");
     goto err;
   }
   n_written = tor_parse_uint64(smartlist_get(elts,4), 10, 0, UINT64_MAX,
                                &ok, NULL);
   if (!ok) {
-    warn(LD_ACCT, "Error parsing number of bytes read");
+    log_warn(LD_ACCT, "Error parsing number of bytes read");
     goto err;
   }
   n_seconds = (uint32_t)tor_parse_ulong(smartlist_get(elts,5), 10,0,ULONG_MAX,
                                         &ok, NULL);
   if (!ok) {
-    warn(LD_ACCT, "Error parsing number of seconds live");
+    log_warn(LD_ACCT, "Error parsing number of seconds live");
     goto err;
   }
   expected_bw =(uint32_t)tor_parse_ulong(smartlist_get(elts,6), 10,0,ULONG_MAX,
                                         &ok, NULL);
   if (!ok) {
-    warn(LD_ACCT, "Error parsing expected bandwidth");
+    log_warn(LD_ACCT, "Error parsing expected bandwidth");
     goto err;
   }
 
@@ -618,7 +624,8 @@ read_bandwidth_usage(void)
   interval_start_time = t1;
   expected_bandwidth_usage = expected_bw;
 
-  info(LD_ACCT, "Successfully read bandwidth accounting file written at %s "
+  log_info(LD_ACCT,
+       "Successfully read bandwidth accounting file written at %s "
        "for interval starting at %s.  We have been active for %lu seconds in "
        "this interval.  At the start of the interval, we expected to use "
        "about %lu KB per second. ("U64_FORMAT" bytes read so far, "
@@ -674,9 +681,9 @@ hibernate_begin(int new_state, time_t no
 
   if (new_state == HIBERNATE_STATE_EXITING &&
       hibernate_state != HIBERNATE_STATE_LIVE) {
-    notice(LD_GENERAL,"Sigint received %s; exiting now.",
-           hibernate_state == HIBERNATE_STATE_EXITING ?
-           "a second time" : "while hibernating");
+    log_notice(LD_GENERAL,"Sigint received %s; exiting now.",
+               hibernate_state == HIBERNATE_STATE_EXITING ?
+               "a second time" : "while hibernating");
     tor_cleanup();
     exit(0);
   }
@@ -685,7 +692,7 @@ hibernate_begin(int new_state, time_t no
   while ((conn = connection_get_by_type(CONN_TYPE_OR_LISTENER)) ||
          (conn = connection_get_by_type(CONN_TYPE_AP_LISTENER)) ||
          (conn = connection_get_by_type(CONN_TYPE_DIR_LISTENER))) {
-    info(LD_NET,"Closing listener type %d", conn->type);
+    log_info(LD_NET,"Closing listener type %d", conn->type);
     connection_mark_for_close(conn);
   }
 
@@ -693,8 +700,8 @@ hibernate_begin(int new_state, time_t no
   /* XXX upload rendezvous service descriptors with no intro points */
 
   if (new_state == HIBERNATE_STATE_EXITING) {
-    notice(LD_GENERAL,"Interrupt: will shut down in %d seconds. Interrupt "
-           "again to exit now.", options->ShutdownWaitLength);
+    log_notice(LD_GENERAL,"Interrupt: will shut down in %d seconds. Interrupt "
+               "again to exit now.", options->ShutdownWaitLength);
     hibernate_end_time = time(NULL) + options->ShutdownWaitLength;
   } else { /* soft limit reached */
     hibernate_end_time = interval_end_time;
@@ -712,7 +719,7 @@ hibernate_end(int new_state)
              hibernate_state == HIBERNATE_STATE_DORMANT);
 
   /* listeners will be relaunched in run_scheduled_events() in main.c */
-  notice(LD_ACCT,"Hibernation period ended. Resuming normal activity.");
+  log_notice(LD_ACCT,"Hibernation period ended. Resuming normal activity.");
 
   hibernate_state = new_state;
   hibernate_end_time = 0; /* no longer hibernating */
@@ -747,7 +754,7 @@ hibernate_go_dormant(time_t now)
   else
     hibernate_begin(HIBERNATE_STATE_DORMANT, now);
 
-  notice(LD_ACCT,"Going dormant. Blowing away remaining connections.");
+  log_notice(LD_ACCT,"Going dormant. Blowing away remaining connections.");
 
   /* Close all OR/AP/exit conns. Leave dir conns because we still want
    * to be able to upload server descriptors so people know we're still
@@ -760,7 +767,7 @@ hibernate_go_dormant(time_t now)
     if (CONN_IS_EDGE(conn))
       connection_edge_end(conn, END_STREAM_REASON_HIBERNATING,
                           conn->cpath_layer);
-    info(LD_NET,"Closing conn type %d", conn->type);
+    log_info(LD_NET,"Closing conn type %d", conn->type);
     if (conn->type == CONN_TYPE_AP) /* send socks failure if needed */
       connection_mark_unattached_ap(conn, END_STREAM_REASON_HIBERNATING);
     else
@@ -789,11 +796,13 @@ hibernate_end_time_elapsed(time_t now)
     format_iso_time(buf,interval_wakeup_time);
     if (hibernate_state != HIBERNATE_STATE_DORMANT) {
       /* We weren't sleeping before; we should sleep now. */
-      notice(LD_ACCT, "Accounting period ended. Commencing hibernation until "
-             "%s GMT",buf);
+      log_notice(LD_ACCT,
+                 "Accounting period ended. Commencing hibernation until "
+                 "%s GMT", buf);
       hibernate_go_dormant(now);
     } else {
-      notice(LD_ACCT, "Accounting period ended. This period, we will hibernate"
+      log_notice(LD_ACCT,
+             "Accounting period ended. This period, we will hibernate"
              " until %s GMT",buf);
     }
   }
@@ -813,7 +822,7 @@ consider_hibernation(time_t now)
   if (hibernate_state == HIBERNATE_STATE_EXITING) {
     tor_assert(hibernate_end_time);
     if (hibernate_end_time <= now) {
-      notice(LD_GENERAL, "Clean shutdown finished. Exiting.");
+      log_notice(LD_GENERAL, "Clean shutdown finished. Exiting.");
       tor_cleanup();
       exit(0);
     }
@@ -836,11 +845,13 @@ consider_hibernation(time_t now)
    * go dormant. */
   if (hibernate_state == HIBERNATE_STATE_LIVE) {
     if (hibernate_soft_limit_reached()) {
-      notice(LD_ACCT,"Bandwidth soft limit reached; commencing hibernation.");
+      log_notice(LD_ACCT,
+                 "Bandwidth soft limit reached; commencing hibernation.");
       hibernate_begin(HIBERNATE_STATE_LOWBANDWIDTH, now);
     } else if (accounting_enabled && now < interval_wakeup_time) {
       format_iso_time(buf,interval_wakeup_time);
-      notice(LD_ACCT,"Commencing hibernation. We will wake up at %s GMT",buf);
+      log_notice(LD_ACCT,
+                 "Commencing hibernation. We will wake up at %s GMT", buf);
       hibernate_go_dormant(now);
     }
   }

Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.622
retrieving revision 1.623
diff -u -p -d -r1.622 -r1.623
--- main.c	9 Feb 2006 05:46:49 -0000	1.622
+++ main.c	13 Feb 2006 09:37:53 -0000	1.623
@@ -118,8 +118,8 @@ connection_add(connection_t *conn)
   tor_assert(conn->s >= 0);
 
   if (nfds >= get_options()->_ConnLimit-1) {
-    warn(LD_NET,"Failing because we have %d connections already. Please "
-         "raise your ulimit -n.", nfds);
+    log_warn(LD_NET,"Failing because we have %d connections already. Please "
+             "raise your ulimit -n.", nfds);
     return -1;
   }
 
@@ -136,8 +136,8 @@ connection_add(connection_t *conn)
 
   nfds++;
 
-  debug(LD_NET,"new conn type %s, socket %d, nfds %d.",
-        conn_type_to_string(conn->type), conn->s, nfds);
+  log_debug(LD_NET,"new conn type %s, socket %d, nfds %d.",
+            conn_type_to_string(conn->type), conn->s, nfds);
 
   return 0;
 }
@@ -154,8 +154,8 @@ connection_remove(connection_t *conn)
   tor_assert(conn);
   tor_assert(nfds>0);
 
-  debug(LD_NET,"removing socket %d (type %s), nfds now %d",
-        conn->s, conn_type_to_string(conn->type), nfds-1);
+  log_debug(LD_NET,"removing socket %d (type %s), nfds now %d",
+            conn->s, conn_type_to_string(conn->type), nfds-1);
 
   tor_assert(conn->poll_index >= 0);
   current_index = conn->poll_index;
@@ -261,11 +261,11 @@ connection_watch_events(connection_t *co
   }
 
   if (r<0)
-    warn(LD_NET,
-         "Error from libevent setting read event state for %d to "
-         "%swatched: %s",
-         conn->s, (events & EV_READ)?"":"un",
-         tor_socket_strerror(tor_socket_errno(conn->s)));
+    log_warn(LD_NET,
+             "Error from libevent setting read event state for %d to "
+             "%swatched: %s",
+             conn->s, (events & EV_READ)?"":"un",
+             tor_socket_strerror(tor_socket_errno(conn->s)));
 
   if (events & EV_WRITE) {
     r = event_add(conn->write_event, NULL);
@@ -274,11 +274,11 @@ connection_watch_events(connection_t *co
   }
 
   if (r<0)
-    warn(LD_NET,
-         "Error from libevent setting read event state for %d to "
-         "%swatched: %s",
-         conn->s, (events & EV_WRITE)?"":"un",
-         tor_socket_strerror(tor_socket_errno(conn->s)));
+    log_warn(LD_NET,
+             "Error from libevent setting read event state for %d to "
+             "%swatched: %s",
+             conn->s, (events & EV_WRITE)?"":"un",
+             tor_socket_strerror(tor_socket_errno(conn->s)));
 }
 
 /** Return true iff <b>conn</b> is listening for read events. */
@@ -297,11 +297,11 @@ connection_stop_reading(connection_t *co
   tor_assert(conn);
   tor_assert(conn->read_event);
 
-  debug(LD_NET,"connection_stop_reading() called.");
+  log_debug(LD_NET,"connection_stop_reading() called.");
   if (event_del(conn->read_event))
-    warn(LD_NET, "Error from libevent setting read event state for %d "
-         "to unwatched.",
-         conn->s);
+    log_warn(LD_NET, "Error from libevent setting read event state for %d "
+             "to unwatched.",
+             conn->s);
 }
 
 /** Tell the main loop to start notifying <b>conn</b> of any read events. */
@@ -312,9 +312,9 @@ connection_start_reading(connection_t *c
   tor_assert(conn->read_event);
 
   if (event_add(conn->read_event, NULL))
-    warn(LD_NET, "Error from libevent setting read event state for %d "
-         "to watched.",
-         conn->s);
+    log_warn(LD_NET, "Error from libevent setting read event state for %d "
+             "to watched.",
+             conn->s);
 }
 
 /** Return true iff <b>conn</b> is listening for write events. */
@@ -334,9 +334,9 @@ connection_stop_writing(connection_t *co
   tor_assert(conn->write_event);
 
   if (event_del(conn->write_event))
-    warn(LD_NET, "Error from libevent setting write event state for %d "
-         "to unwatched.",
-         conn->s);
+    log_warn(LD_NET, "Error from libevent setting write event state for %d "
+             "to unwatched.",
+             conn->s);
 
 }
 
@@ -348,9 +348,9 @@ connection_start_writing(connection_t *c
   tor_assert(conn->write_event);
 
   if (event_add(conn->write_event, NULL))
-    warn(LD_NET, "Error from libevent setting write event state for %d "
-         "to watched.",
-         conn->s);
+    log_warn(LD_NET, "Error from libevent setting write event state for %d "
+             "to watched.",
+             conn->s);
 }
 
 /** Close all connections that have been scheduled to get closed */
@@ -376,16 +376,16 @@ conn_read_callback(int fd, short event, 
 {
   connection_t *conn = _conn;
 
-  debug(LD_NET,"socket %d wants to read.",conn->s);
+  log_debug(LD_NET,"socket %d wants to read.",conn->s);
 
   assert_connection_ok(conn, time(NULL));
 
   if (connection_handle_read(conn) < 0) {
     if (!conn->marked_for_close) {
 #ifndef MS_WINDOWS
-      warn(LD_BUG,"Bug: unhandled error on read for %s connection "
-           "(fd %d); removing",
-           conn_type_to_string(conn->type), conn->s);
+      log_warn(LD_BUG,"Bug: unhandled error on read for %s connection "
+               "(fd %d); removing",
+               conn_type_to_string(conn->type), conn->s);
       tor_fragile_assert();
 #endif
       if (CONN_IS_EDGE(conn))
@@ -448,19 +448,19 @@ conn_close_if_marked(int i)
   assert_connection_ok(conn, time(NULL));
   assert_all_pending_dns_resolves_ok();
 
-  debug(LD_NET,"Cleaning up connection (fd %d).",conn->s);
+  log_debug(LD_NET,"Cleaning up connection (fd %d).",conn->s);
   if (conn->s >= 0 && connection_wants_to_flush(conn)) {
     /* s == -1 means it's an incomplete edge connection, or that the socket
      * has already been closed as unflushable. */
     int sz = connection_bucket_write_limit(conn);
     if (!conn->hold_open_until_flushed)
-      info(LD_NET,
-           "Conn (addr %s, fd %d, type %s, state %d) marked, but wants "
-           "to flush %d bytes. (Marked at %s:%d)",
-           conn->address, conn->s, conn_type_to_string(conn->type),
-           conn->state,
-           (int)conn->outbuf_flushlen,
-            conn->marked_for_close_file, conn->marked_for_close);
+      log_info(LD_NET,
+               "Conn (addr %s, fd %d, type %s, state %d) marked, but wants "
+               "to flush %d bytes. (Marked at %s:%d)",
+               conn->address, conn->s, conn_type_to_string(conn->type),
+               conn->state,
+               (int)conn->outbuf_flushlen,
+                conn->marked_for_close_file, conn->marked_for_close);
     if (connection_speaks_cells(conn)) {
       if (conn->state == OR_CONN_STATE_OPEN) {
         retval = flush_buf_tls(conn->tls, conn->outbuf, sz,
@@ -516,9 +516,11 @@ directory_all_unreachable(time_t now)
 
   while ((conn = connection_get_by_type_state(CONN_TYPE_AP,
                                               AP_CONN_STATE_CIRCUIT_WAIT))) {
-    notice(LD_NET,
-           "Is your network connection down? Failing connection to '%s:%d'.",
-           safe_str(conn->socks_request->address), conn->socks_request->port);
+    log_notice(LD_NET,
+               "Is your network connection down? "
+               "Failing connection to '%s:%d'.",
+               safe_str(conn->socks_request->address),
+               conn->socks_request->port);
     connection_mark_unattached_ap(conn, END_STREAM_REASON_NET_UNREACHABLE);
   }
 }
@@ -602,14 +604,14 @@ run_connection_housekeeping(int i, time_
   /* Expire any directory connections that haven't sent anything for 5 min */
   if (conn->type == CONN_TYPE_DIR &&
       conn->timestamp_lastwritten + 5*60 < now) {
-    info(LD_DIR,"Expiring wedged directory conn (fd %d, purpose %d)",
-         conn->s, conn->purpose);
+    log_info(LD_DIR,"Expiring wedged directory conn (fd %d, purpose %d)",
+             conn->s, conn->purpose);
     /* This check is temporary; it's to let us know whether we should consider
      * parsing partial serverdesc responses. */
     if (conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC &&
         buf_datalen(conn->inbuf)>=1024) {
-      info(LD_DIR,"Trying to extract information from wedged server desc "
-           "download.");
+      log_info(LD_DIR,"Trying to extract information from wedged server desc "
+               "download.");
       connection_dir_reached_eof(conn);
     } else {
       connection_mark_for_close(conn);
@@ -623,18 +625,20 @@ run_connection_housekeeping(int i, time_
 #define TIME_BEFORE_OR_CONN_IS_OBSOLETE (60*60*24*7) /* a week */
   if (!conn->is_obsolete) {
     if (conn->timestamp_created + TIME_BEFORE_OR_CONN_IS_OBSOLETE < now) {
-      info(LD_OR, "Marking OR conn to %s:%d obsolete (fd %d, %d secs old).",
-           conn->address, conn->port, conn->s,
-           (int)(now - conn->timestamp_created));
+      log_info(LD_OR,
+               "Marking OR conn to %s:%d obsolete (fd %d, %d secs old).",
+               conn->address, conn->port, conn->s,
+               (int)(now - conn->timestamp_created));
       conn->is_obsolete = 1;
     } else {
       connection_t *best =
         connection_or_get_by_identity_digest(conn->identity_digest);
       if (best && best != conn) {
-        info(LD_OR,
-             "Marking duplicate conn to %s:%d obsolete (fd %d, %d secs old).",
-             conn->address, conn->port, conn->s,
-             (int)(now - conn->timestamp_created));
+        log_info(LD_OR,
+                 "Marking duplicate conn to %s:%d obsolete "
+                 "(fd %d, %d secs old).",
+                 conn->address, conn->port, conn->s,
+                 (int)(now - conn->timestamp_created));
         conn->is_obsolete = 1;
       }
     }
@@ -642,8 +646,9 @@ run_connection_housekeeping(int i, time_
 
   if (conn->is_obsolete && conn->n_circuits == 0) {
     /* no unmarked circs -- mark it now */
-    info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) [Obsolete].",
-         conn->s,conn->address, conn->port);
+    log_info(LD_OR,
+             "Expiring non-used OR connection to fd %d (%s:%d) [Obsolete].",
+             conn->s,conn->address, conn->port);
     connection_mark_for_close(conn);
     conn->hold_open_until_flushed = 1;
     return;
@@ -654,23 +659,23 @@ run_connection_housekeeping(int i, time_
   if (now >= conn->timestamp_lastwritten + options->KeepalivePeriod) {
     routerinfo_t *router = router_get_by_digest(conn->identity_digest);
     if (!connection_state_is_open(conn)) {
-      info(LD_OR,"Expiring non-open OR connection to fd %d (%s:%d).",
-           conn->s,conn->address, conn->port);
+      log_info(LD_OR,"Expiring non-open OR connection to fd %d (%s:%d).",
+               conn->s,conn->address, conn->port);
       connection_mark_for_close(conn);
       conn->hold_open_until_flushed = 1;
     } else if (we_are_hibernating() && conn->n_circuits == 0 &&
                !buf_datalen(conn->outbuf)) {
-      info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) "
-           "[Hibernating or exiting].",
-             conn->s,conn->address, conn->port);
+      log_info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) "
+               "[Hibernating or exiting].",
+               conn->s,conn->address, conn->port);
       connection_mark_for_close(conn);
       conn->hold_open_until_flushed = 1;
     } else if (!clique_mode(options) && conn->n_circuits &&
                (!router || !server_mode(options) ||
                 !router_is_clique_mode(router))) {
-      info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) "
-           "[Not in clique mode].",
-           conn->s,conn->address, conn->port);
+      log_info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) "
+               "[Not in clique mode].",
+               conn->s,conn->address, conn->port);
       connection_mark_for_close(conn);
       conn->hold_open_until_flushed = 1;
     } else if (
@@ -724,11 +729,11 @@ run_scheduled_events(time_t now)
    */
   if (server_mode(options) &&
       get_onion_key_set_at()+MIN_ONION_KEY_LIFETIME < now) {
-    info(LD_GENERAL,"Rotating onion key.");
+    log_info(LD_GENERAL,"Rotating onion key.");
     rotate_onion_key();
     cpuworkers_rotate();
     if (router_rebuild_descriptor(1)<0) {
-      warn(LD_BUG, "Couldn't rebuild router descriptor");
+      log_warn(LD_BUG, "Couldn't rebuild router descriptor");
     }
     if (advertised_server_mode())
       router_upload_dir_desc_to_dirservers(0);
@@ -749,10 +754,10 @@ run_scheduled_events(time_t now)
   if (!last_rotated_certificate)
     last_rotated_certificate = now;
   if (last_rotated_certificate+MAX_SSL_KEY_LIFETIME < now) {
-    info(LD_GENERAL,"Rotating tls context.");
+    log_info(LD_GENERAL,"Rotating tls context.");
     if (tor_tls_context_new(get_identity_key(), 1, options->Nickname,
                             MAX_SSL_KEY_LIFETIME) < 0) {
-      warn(LD_BUG, "Error reinitializing TLS context");
+      log_warn(LD_BUG, "Error reinitializing TLS context");
       /* XXX is it a bug here, that we just keep going? */
     }
     last_rotated_certificate = now;
@@ -960,15 +965,16 @@ second_elapsed_callback(int fd, short ev
     /* every 20 minutes, check and complain if necessary */
     routerinfo_t *me = router_get_my_routerinfo();
     if (me && !check_whether_orport_reachable())
-      warn(LD_CONFIG,"Your server (%s:%d) has not managed to confirm that "
-           "its ORPort is reachable. Please check your firewalls, ports, "
-           "address, /etc/hosts file, etc.",
-           me->address, me->or_port);
+      log_warn(LD_CONFIG,"Your server (%s:%d) has not managed to confirm that "
+               "its ORPort is reachable. Please check your firewalls, ports, "
+               "address, /etc/hosts file, etc.",
+               me->address, me->or_port);
     if (me && !check_whether_dirport_reachable())
-      warn(LD_CONFIG,"Your server (%s:%d) has not managed to confirm that its "
-           "DirPort is reachable. Please check your firewalls, ports, "
-           "address, /etc/hosts file, etc.",
-           me->address, me->dir_port);
+      log_warn(LD_CONFIG,
+               "Your server (%s:%d) has not managed to confirm that its "
+               "DirPort is reachable. Please check your firewalls, ports, "
+               "address, /etc/hosts file, etc.",
+               me->address, me->dir_port);
   }
 
   /* if more than 100s have elapsed, probably the clock jumped: doesn't
@@ -991,8 +997,8 @@ second_elapsed_callback(int fd, short ev
 #endif
 
   if (evtimer_add(timeout_event, &one_second))
-    err(LD_NET,
-        "Error from libevent when setting one-second timeout event");
+    log_err(LD_NET,
+            "Error from libevent when setting one-second timeout event");
 }
 
 /** Called when a possibly ignorable libevent error occurs; ensures that we
@@ -1002,7 +1008,7 @@ static int
 got_libevent_error(void)
 {
   if (++n_libevent_errors > 8) {
-    err(LD_NET, "Too many libevent errors in one second; dying");
+    log_err(LD_NET, "Too many libevent errors in one second; dying");
     return -1;
   }
   return 0;
@@ -1016,7 +1022,7 @@ do_hup(void)
   char keydir[512];
   or_options_t *options = get_options();
 
-  notice(LD_GENERAL,"Received reload signal (hup). Reloading config.");
+  log_notice(LD_GENERAL,"Received reload signal (hup). Reloading config.");
   has_completed_circuit=0;
   if (accounting_is_enabled(options))
     accounting_record_bandwidth_usage(time(NULL));
@@ -1027,8 +1033,8 @@ do_hup(void)
   /* first, reload config variables, in case they've changed */
   /* no need to provide argc/v, they've been cached inside init_from_config */
   if (options_init_from_torrc(0, NULL) < 0) {
-    err(LD_CONFIG,"Reading config failed--see warnings above. "
-        "For usage, try -h.");
+    log_err(LD_CONFIG,"Reading config failed--see warnings above. "
+            "For usage, try -h.");
     return -1;
   }
   options = get_options(); /* they have changed now */
@@ -1036,10 +1042,11 @@ do_hup(void)
     /* reload the approved-routers file */
     tor_snprintf(keydir, sizeof(keydir),
                  "%s/approved-routers", options->DataDirectory);
-    info(LD_GENERAL,"Reloading approved fingerprints from \"%s\"...",keydir);
+    log_info(LD_GENERAL,
+             "Reloading approved fingerprints from \"%s\"...", keydir);
     if (dirserv_parse_fingerprint_file(keydir) < 0) {
-      info(LD_GENERAL, "Error reloading fingerprints. "
-           "Continuing with old list.");
+      log_info(LD_GENERAL, "Error reloading fingerprints. "
+               "Continuing with old list.");
     }
   }
 
@@ -1068,7 +1075,7 @@ do_hup(void)
     if (descriptor) {
       tor_snprintf(keydir,sizeof(keydir),"%s/router.desc",
                    options->DataDirectory);
-      info(LD_OR,"Saving descriptor to \"%s\"...",keydir);
+      log_info(LD_OR,"Saving descriptor to \"%s\"...",keydir);
       if (write_str_to_file(keydir, descriptor, 0)) {
         return 0;
       }
@@ -1091,7 +1098,7 @@ do_main_loop(void)
    * TLS context. */
   if (! identity_key_is_set()) {
     if (init_keys() < 0) {
-      err(LD_GENERAL,"Error initializing keys; exiting");
+      log_err(LD_GENERAL,"Error initializing keys; exiting");
       return -1;
     }
   }
@@ -1143,23 +1150,24 @@ do_main_loop(void)
       /* let the program survive things like ^z */
       if (e != EINTR && !ERRNO_IS_EINPROGRESS(e)) {
 #ifdef HAVE_EVENT_GET_METHOD
-        err(LD_NET,"libevent call with %s failed: %s [%d]",
-            event_get_method(), tor_socket_strerror(e), e);
+        log_err(LD_NET,"libevent call with %s failed: %s [%d]",
+                event_get_method(), tor_socket_strerror(e), e);
 #else
-        err(LD_NET,"libevent call failed: %s [%d]",
-            tor_socket_strerror(e), e);
+        log_err(LD_NET,"libevent call failed: %s [%d]",
+                tor_socket_strerror(e), e);
 #endif
         return -1;
 #ifndef MS_WINDOWS
       } else if (e == EINVAL) {
-        warn(LD_NET, "EINVAL from libevent: should you upgrade libevent?");
+        log_warn(LD_NET, "EINVAL from libevent: should you upgrade libevent?");
         if (got_libevent_error())
           return -1;
 #endif
       } else {
         if (ERRNO_IS_EINPROGRESS(e))
-          warn(LD_BUG,"libevent call returned EINPROGRESS? Please report.");
-        debug(LD_NET,"libevent call interrupted.");
+          log_warn(LD_BUG,
+                   "libevent call returned EINPROGRESS? Please report.");
+        log_debug(LD_NET,"libevent call interrupted.");
         /* You can't trust the results of this poll(). Go back to the
          * top of the big for loop. */
         continue;
@@ -1217,13 +1225,13 @@ signal_callback(int fd, short events, vo
   switch (sig)
     {
     case SIGTERM:
-      err(LD_GENERAL,"Catching signal TERM, exiting cleanly.");
+      log_err(LD_GENERAL,"Catching signal TERM, exiting cleanly.");
       tor_cleanup();
       exit(0);
       break;
     case SIGINT:
       if (!server_mode(get_options())) { /* do it now */
-        notice(LD_GENERAL,"Interrupt: exiting cleanly.");
+        log_notice(LD_GENERAL,"Interrupt: exiting cleanly.");
         tor_cleanup();
         exit(0);
       }
@@ -1231,7 +1239,7 @@ signal_callback(int fd, short events, vo
       break;
 #ifdef SIGPIPE
     case SIGPIPE:
-      debug(LD_GENERAL,"Caught sigpipe. Ignoring.");
+      log_debug(LD_GENERAL,"Caught sigpipe. Ignoring.");
       break;
 #endif
     case SIGUSR1:
@@ -1240,12 +1248,12 @@ signal_callback(int fd, short events, vo
       break;
     case SIGUSR2:
       switch_logs_debug();
-      debug(LD_GENERAL,"Caught USR2, going to loglevel debug. "
-            "Send HUP to change back.");
+      log_debug(LD_GENERAL,"Caught USR2, going to loglevel debug. "
+                "Send HUP to change back.");
       break;
     case SIGHUP:
       if (do_hup() < 0) {
-        warn(LD_CONFIG,"Restart failed (config error?). Exiting.");
+        log_warn(LD_CONFIG,"Restart failed (config error?). Exiting.");
         tor_cleanup();
         exit(1);
       }
@@ -1402,8 +1410,8 @@ handle_signals(int is_parent)
       signal_set(&signal_events[i], signals[i], signal_callback,
                  (void*)(uintptr_t)signals[i]);
       if (signal_add(&signal_events[i], NULL))
-        warn(LD_BUG, "Error from libevent when adding event for signal %d",
-             signals[i]);
+        log_warn(LD_BUG, "Error from libevent when adding event for signal %d",
+                 signals[i]);
     }
   } else {
     struct sigaction action;
@@ -1445,26 +1453,26 @@ tor_init(int argc, char *argv[])
       "Do not rely on it for strong anonymity.",VERSION);
 
   if (network_init()<0) {
-    err(LD_NET,"Error initializing network; exiting.");
+    log_err(LD_NET,"Error initializing network; exiting.");
     return -1;
   }
   atexit(exit_function);
 
   if (options_init_from_torrc(argc,argv) < 0) {
-    err(LD_CONFIG,"Reading config failed--see warnings above. "
-        "For usage, try -h.");
+    log_err(LD_CONFIG,"Reading config failed--see warnings above. "
+            "For usage, try -h.");
     return -1;
   }
 
 #ifndef MS_WINDOWS
   if (geteuid()==0)
-    warn(LD_GENERAL,"You are running Tor as root. You don't need to, "
-         "and you probably shouldn't.");
+    log_warn(LD_GENERAL,"You are running Tor as root. You don't need to, "
+             "and you probably shouldn't.");
 #endif
 
   crypto_global_init(get_options()->HardwareAccel);
   if (crypto_seed_rng()) {
-    err(LD_BUG, "Unable to seed random number generator. Exiting.");
+    log_err(LD_BUG, "Unable to seed random number generator. Exiting.");
     return -1;
   }
 
@@ -1540,15 +1548,15 @@ do_list_fingerprint(void)
   }
   tor_assert(nickname);
   if (init_keys() < 0) {
-    err(LD_BUG,"Error initializing keys; exiting");
+    log_err(LD_BUG,"Error initializing keys; exiting");
     return;
   }
   if (!(k = get_identity_key())) {
-    err(LD_GENERAL,"Error: missing identity key.");
+    log_err(LD_GENERAL,"Error: missing identity key.");
     return;
   }
   if (crypto_pk_get_fingerprint(k, buf, 1)<0) {
-    warn(LD_BUG, "Error computing fingerprint");
+    log_warn(LD_BUG, "Error computing fingerprint");
     return;
   }
   printf("%s %s\n", nickname, buf);
@@ -1645,7 +1653,8 @@ nt_service_control(DWORD request)
   switch (request) {
     case SERVICE_CONTROL_STOP:
         case SERVICE_CONTROL_SHUTDOWN:
-          err(LD_GENERAL, "Got stop/shutdown request; shutting down cleanly.");
+          log_err(LD_GENERAL,
+                  "Got stop/shutdown request; shutting down cleanly.");
           service_status.dwCurrentState = SERVICE_STOP_PENDING;
           event_loopexit(&exit_now);
           return;
@@ -1683,8 +1692,8 @@ nt_service_body(int argc, char **argv)
     }
   }
   else {
-    err(LD_CONFIG, "torrc is not in the current working directory. "
-        "The Tor service will not start.");
+    log_err(LD_CONFIG, "torrc is not in the current working directory. "
+            "The Tor service will not start.");
     r = NT_SERVICE_ERROR_NO_TORRC;
   }
 
@@ -1737,8 +1746,8 @@ nt_service_main(void)
         printf("Configuration was valid\n");
         break;
       default:
-        err(LD_CONFIG, "Illegal command number %d: internal error.",
-            get_options()->command);
+        log_err(LD_CONFIG, "Illegal command number %d: internal error.",
+                get_options()->command);
       }
       tor_cleanup();
     }
@@ -2062,7 +2071,7 @@ tor_main(int argc, char *argv[])
 #ifdef USE_DMALLOC
     int r = CRYPTO_set_mem_ex_functions(_tor_malloc, _tor_realloc,
                                         _tor_dmalloc_free);
-    notice(LD_CONFIG, "Set up damalloc; returned %d", r);
+    log_notice(LD_CONFIG, "Set up damalloc; returned %d", r);
 #endif
 #ifdef MS_WINDOWS_SERVICE
   backup_argv = argv;
@@ -2111,8 +2120,8 @@ tor_main(int argc, char *argv[])
     printf("Configuration was valid\n");
     break;
   default:
-    warn(LD_BUG,"Illegal command number %d: internal error.",
-         get_options()->command);
+    log_warn(LD_BUG,"Illegal command number %d: internal error.",
+             get_options()->command);
   }
   tor_cleanup();
   return -1;

Index: onion.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/onion.c,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -p -d -r1.195 -r1.196
--- onion.c	9 Feb 2006 05:46:49 -0000	1.195
+++ onion.c	13 Feb 2006 09:37:53 -0000	1.196
@@ -57,11 +57,11 @@ onion_pending_add(circuit_t *circ)
   tor_assert(!ol_tail->next);
 
   if (ol_length >= get_options()->MaxOnionsPending) {
-    warn(LD_GENERAL,
-         "Your computer is too slow to handle this many circuit "
-         "creation requests! Please consider using the "
-         "MaxAdvertisedBandwidth config option or choosing a more "
-         "restricted exit policy.");
+    log_warn(LD_GENERAL,
+             "Your computer is too slow to handle this many circuit "
+             "creation requests! Please consider using the "
+             "MaxAdvertisedBandwidth config option or choosing a more "
+             "restricted exit policy.");
     tor_free(tmp);
     return -1;
   }
@@ -73,8 +73,8 @@ onion_pending_add(circuit_t *circ)
     /* cull elderly requests. */
     circ = ol_list->circ;
     onion_pending_remove(ol_list->circ);
-    info(LD_CIRC,
-         "Circuit create request is too old; cancelling due to overload.");
+    log_info(LD_CIRC,
+             "Circuit create request is too old; cancelling due to overload.");
     circuit_mark_for_close(circ, END_CIRC_REASON_RESOURCELIMIT);
   }
   return 0;
@@ -122,9 +122,9 @@ onion_pending_remove(circuit_t *circ)
   } else { /* we need to hunt through the rest of the list */
     for ( ;tmpo->next && tmpo->next->circ != circ; tmpo=tmpo->next) ;
     if (!tmpo->next) {
-      debug(LD_GENERAL,
-            "circ (p_circ_id %d) not in list, probably at cpuworker.",
-            circ->p_circ_id);
+      log_debug(LD_GENERAL,
+                "circ (p_circ_id %d) not in list, probably at cpuworker.",
+                circ->p_circ_id);
       return;
     }
     /* now we know tmpo->next->circ == circ */
@@ -244,18 +244,18 @@ onion_skin_server_handshake(const char *
       break;
   }
   if (len<0) {
-    info(LD_PROTOCOL,
-         "Couldn't decrypt onionskin: client may be using old onion key");
+    log_info(LD_PROTOCOL,
+             "Couldn't decrypt onionskin: client may be using old onion key");
     goto err;
   } else if (len != DH_KEY_LEN) {
-    warn(LD_PROTOCOL, "Unexpected onionskin length after decryption: %d",
-         len);
+    log_warn(LD_PROTOCOL, "Unexpected onionskin length after decryption: %d",
+             len);
     goto err;
   }
 
   dh = crypto_dh_new();
   if (crypto_dh_get_public(dh, handshake_reply_out, DH_KEY_LEN)) {
-    info(LD_GENERAL, "crypto_dh_get_public failed.");
+    log_info(LD_GENERAL, "crypto_dh_get_public failed.");
     goto err;
   }
 
@@ -271,7 +271,7 @@ onion_skin_server_handshake(const char *
   len = crypto_dh_compute_secret(dh, challenge, DH_KEY_LEN,
                                  key_material, DIGEST_LEN+key_out_len);
   if (len < 0) {
-    info(LD_GENERAL, "crypto_dh_compute_secret failed.");
+    log_info(LD_GENERAL, "crypto_dh_compute_secret failed.");
     goto err;
   }
 
@@ -336,8 +336,8 @@ onion_skin_client_handshake(crypto_dh_en
   if (memcmp(key_material, handshake_reply+DH_KEY_LEN, 20)) {
     /* H(K) does *not* match. Something fishy. */
     tor_free(key_material);
-    warn(LD_PROTOCOL,"Digest DOES NOT MATCH on onion handshake. "
-         "Bug or attack.");
+    log_warn(LD_PROTOCOL,"Digest DOES NOT MATCH on onion handshake. "
+             "Bug or attack.");
     return -1;
   }
 
@@ -422,8 +422,8 @@ fast_client_handshake(const char *handsh
   }
   if (memcmp(out, handshake_reply_out+DIGEST_LEN, DIGEST_LEN)) {
     /* H(K) does *not* match. Something fishy. */
-    warn(LD_PROTOCOL,"Digest DOES NOT MATCH on fast handshake. "
-         "Bug or attack.");
+    log_warn(LD_PROTOCOL,"Digest DOES NOT MATCH on fast handshake. "
+             "Bug or attack.");
     return -1;
   }
   memcpy(key_out, out+DIGEST_LEN, key_out_len);



More information about the tor-commits mailing list