From 2ad18ae7366ce4979b44fa53d0105940005489c0 Mon Sep 17 00:00:00 2001 From: Robert Ransom Date: Mon, 25 Apr 2011 08:36:02 -0700 Subject: Allow rend_client_send_introduction to fail transiently i.e. without closing the AP connection. --- src/or/circuituse.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/or/circuituse.c') diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 996c99cef1..247aca7e07 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1560,14 +1560,20 @@ connection_ap_handshake_attach_circuit(edge_connection_t *conn) "introduction. (stream %d sec old)", introcirc->_base.n_circ_id, rendcirc->_base.n_circ_id, conn_age); - if (rend_client_send_introduction(introcirc, rendcirc) < 0) { + switch (rend_client_send_introduction(introcirc, rendcirc)) { + case 0: /* success */ + rendcirc->_base.timestamp_dirty = time(NULL); + introcirc->_base.timestamp_dirty = time(NULL); + assert_circuit_ok(TO_CIRCUIT(rendcirc)); + assert_circuit_ok(TO_CIRCUIT(introcirc)); + return 0; + case -1: /* transient error */ + return 0; + case -2: /* permanent error */ return -1; + default: /* oops */ + tor_fragile_assert(); } - rendcirc->_base.timestamp_dirty = time(NULL); - introcirc->_base.timestamp_dirty = time(NULL); - assert_circuit_ok(TO_CIRCUIT(rendcirc)); - assert_circuit_ok(TO_CIRCUIT(introcirc)); - return 0; } } -- cgit v1.2.3-54-g00ecf From 8a36f2125137dc31a0771a8eeac0f2bb8c1343d0 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Thu, 28 Apr 2011 01:48:25 +0200 Subject: Fix a failure case of connection_ap_handshake_attach_circuit() tor_fragile_assert() might be a no-op, so we have to return something here to indicate failure to the caller. --- src/or/circuituse.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/or/circuituse.c') diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 247aca7e07..6a9c3975c2 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1573,6 +1573,7 @@ connection_ap_handshake_attach_circuit(edge_connection_t *conn) return -1; default: /* oops */ tor_fragile_assert(); + return -1; } } } -- cgit v1.2.3-54-g00ecf