[or-cvs] Dump introduction point status on kill -USR1

Nick Mathewson nickm at seul.org
Fri Apr 9 20:02:18 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv31323/src/or

Modified Files:
	main.c or.h rendservice.c 
Log Message:
Dump introduction point status on kill -USR1

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.234
retrieving revision 1.235
diff -u -d -r1.234 -r1.235
--- main.c	9 Apr 2004 19:37:50 -0000	1.234
+++ main.c	9 Apr 2004 20:02:16 -0000	1.235
@@ -747,6 +747,7 @@
            (int) (stats_n_bytes_read/stats_n_seconds_reading));
 
   rep_hist_dump_stats(now,severity);
+  rend_service_dump_stats(severity);
 }
 
 int network_init(void)

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.310
retrieving revision 1.311
diff -u -d -r1.310 -r1.311
--- or.h	9 Apr 2004 09:39:42 -0000	1.310
+++ or.h	9 Apr 2004 20:02:16 -0000	1.311
@@ -684,6 +684,7 @@
 
 /********************************* circuit.c ***************************/
 
+extern char *circuit_state_to_string[];
 void circuit_add(circuit_t *circ);
 void circuit_remove(circuit_t *circ);
 circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn);
@@ -1111,7 +1112,7 @@
 void rend_service_rendezvous_is_ready(circuit_t *circuit);
 int rend_service_introduce(circuit_t *circuit, const char *request, int request_len);
 int rend_service_set_connection_addr_port(connection_t *conn, circuit_t *circ);
-
+void rend_service_dump_stats(int severity);
 
 /********************************* rendmid.c *******************************/
 int rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len);

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- rendservice.c	8 Apr 2004 04:47:39 -0000	1.44
+++ rendservice.c	9 Apr 2004 20:02:16 -0000	1.45
@@ -732,6 +732,7 @@
     if (rend_encode_service_descriptor(service->desc,
                                        service->private_key,
                                        &desc, &desc_len)<0) {
+
       log_fn(LOG_WARN, "Couldn't encode service descriptor; not uploading");
       continue;
     }
@@ -755,6 +756,36 @@
   return 0;
 }
 
+void
+rend_service_dump_stats(int severity)
+{
+  int i,j;
+  routerinfo_t *router;
+  rend_service_t *service;
+  char *nickname;
+  circuit_t *circ;
+
+  for (i=0; i < smartlist_len(rend_service_list); ++i) {
+    service = smartlist_get(rend_service_list, i);
+    log(severity, "Service configured in %s:", service->directory);
+    for (j=0; j < smartlist_len(service->intro_nodes); ++j) {
+      nickname = smartlist_get(service->intro_nodes, j);
+      router = router_get_by_nickname(smartlist_get(service->intro_nodes,j));
+      if (!router) {
+        log(severity, "  Intro point at %s: unrecognized router",nickname);
+        continue;
+      }
+      circ = find_intro_circuit(router, service->pk_digest);
+      if (!circ) {
+        log(severity, "  Intro point at %s: no circuit",nickname);
+        continue;
+      }
+      log(severity, "  Intro point at %s: circuit is %s",nickname,
+          circuit_state_to_string[circ->state]);
+    }
+  }
+}
+
 /* This is a beginning rendezvous stream. Look up conn->port,
  * and assign the actual conn->addr and conn->port. Return -1
  * if failure, or 0 for success.



More information about the tor-commits mailing list