summaryrefslogtreecommitdiff
path: root/src/or/rendmid.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-02 23:30:54 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-02 23:30:54 +0000
commite8345bfced697f96fbb885298e464760988d71e4 (patch)
tree4e09651306f7d2a007b3681b92e0c340eebe4d8b /src/or/rendmid.c
parent25a9bc594f22fc29604b17cb0f7eaab74401db29 (diff)
downloadtor-e8345bfced697f96fbb885298e464760988d71e4.tar.gz
tor-e8345bfced697f96fbb885298e464760988d71e4.zip
refactor; start adding debugging logs to midpoint rend stuff
svn:r1445
Diffstat (limited to 'src/or/rendmid.c')
-rw-r--r--src/or/rendmid.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/or/rendmid.c b/src/or/rendmid.c
index 7fe4d0d4ad..ab2e07c70c 100644
--- a/src/or/rendmid.c
+++ b/src/or/rendmid.c
@@ -16,9 +16,12 @@ rend_mid_establish_intro(circuit_t *circ, char *request, int request_len)
char pk_digest[20];
int asn1len;
circuit_t *c;
+ char hexid[9];
- if (circ->purpose != CIRCUIT_PURPOSE_INTERMEDIATE) {
- log_fn(LOG_WARN, "Rejecting ESTABLISH_INTRO on non-intermediate circuit");
+ log_fn(LOG_INFO, "Received an ESTABLISH_INTRO request on circuit %d", circ->p_circ_id);
+
+ if (circ->purpose != CIRCUIT_PURPOSE_OR || circ->n_conn) {
+ log_fn(LOG_WARN, "Rejecting ESTABLISH_INTRO on non-OR or non-edge circuit");
goto err;
}
if (request_len < 22)
@@ -60,10 +63,13 @@ rend_mid_establish_intro(circuit_t *circ, char *request, int request_len)
goto err;
}
+ hex_encode(pk_digest, 4, hexid);
+
/* Close any other intro circuits with the same pk. */
c = NULL;
while ((c = circuit_get_next_by_service_and_purpose(
c,pk_digest,CIRCUIT_PURPOSE_INTRO_POINT))) {
+ log_fn(LOG_INFO, "Replacing old circuit %d for service %s", c->p_circ_id, hexid);
circuit_mark_for_close(c);
}
@@ -71,6 +77,9 @@ rend_mid_establish_intro(circuit_t *circ, char *request, int request_len)
circ->purpose = CIRCUIT_PURPOSE_INTRO_POINT;
memcpy(circ->rend_service, pk_digest, 20);
+ log_fn(LOG_INFO, "Established introduction point on circuit %d for service %s",
+ circ->p_circ_id, hexid);
+
return 0;
truncated:
log_fn(LOG_WARN, "Rejecting truncated ESTABLISH_INTRO cell");
@@ -123,8 +132,8 @@ rend_mid_introduce(circuit_t *circ, char *request, int request_len)
int
rend_mid_establish_rendezvous(circuit_t *circ, char *request, int request_len)
{
- if (circ->purpose != CIRCUIT_PURPOSE_INTERMEDIATE) {
- log_fn(LOG_WARN, "Tried to establish rendezvous on non-intermediate circuit");
+ if (circ->purpose != CIRCUIT_PURPOSE_OR || circ->n_conn) {
+ log_fn(LOG_WARN, "Tried to establish rendezvous on non-OR or non-edge circuit");
goto err;
}
@@ -155,8 +164,8 @@ rend_mid_rendezvous(circuit_t *circ, char *request, int request_len)
{
circuit_t *rend_circ;
- if (circ->purpose != CIRCUIT_PURPOSE_INTERMEDIATE) {
- log_fn(LOG_WARN, "Tried to complete rendezvous on non-intermediate circuit");
+ if (circ->purpose != CIRCUIT_PURPOSE_OR || circ->n_conn) {
+ log_fn(LOG_WARN, "Tried to complete rendezvous on non-OR or non-edge circuit");
goto err;
}