diff options
author | Robert Ransom <rransom.8774@gmail.com> | 2011-04-25 08:36:02 -0700 |
---|---|---|
committer | Sebastian Hahn <sebastian@torproject.org> | 2011-04-28 18:14:50 +0200 |
commit | 2ad18ae7366ce4979b44fa53d0105940005489c0 (patch) | |
tree | c421f6b2f4438e56e1b361b84e2c628392c056ff /src/or/circuituse.c | |
parent | 440e48ddf27094e48c401c68c9014eca43b6867e (diff) | |
download | tor-2ad18ae7366ce4979b44fa53d0105940005489c0.tar.gz tor-2ad18ae7366ce4979b44fa53d0105940005489c0.zip |
Allow rend_client_send_introduction to fail transiently
i.e. without closing the AP connection.
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r-- | src/or/circuituse.c | 18 |
1 files changed, 12 insertions, 6 deletions
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; } } |