aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-09 20:02:16 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-09 20:02:16 +0000
commit4e1b65f53dd838349d28eab91c9ab2ce6674c3cf (patch)
tree395105f89ad19d547aad0bd662694bf5f30a34b5 /src
parentf9ade70cf9b41753c9027ca1f32f5b58a29e8bca (diff)
downloadtor-4e1b65f53dd838349d28eab91c9ab2ce6674c3cf.tar
tor-4e1b65f53dd838349d28eab91c9ab2ce6674c3cf.tar.gz
Dump introduction point status on kill -USR1
svn:r1584
Diffstat (limited to 'src')
-rw-r--r--src/or/main.c1
-rw-r--r--src/or/or.h3
-rw-r--r--src/or/rendservice.c31
3 files changed, 34 insertions, 1 deletions
diff --git a/src/or/main.c b/src/or/main.c
index d20555208..d29ad7347 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -747,6 +747,7 @@ static void dumpstats(int severity) {
(int) (stats_n_bytes_read/stats_n_seconds_reading));
rep_hist_dump_stats(now,severity);
+ rend_service_dump_stats(severity);
}
int network_init(void)
diff --git a/src/or/or.h b/src/or/or.h
index 5e868a9ab..5d6717b9f 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -684,6 +684,7 @@ void assert_buf_ok(buf_t *buf);
/********************************* 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 @@ int rend_service_intro_established(circuit_t *circuit, const char *request, int
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);
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index f2b9318c4..6790d5ab7 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -732,6 +732,7 @@ int rend_services_init(void) {
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 @@ int rend_services_init(void) {
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.