diff options
author | Roger Dingledine <arma@torproject.org> | 2004-08-07 02:19:49 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-08-07 02:19:49 +0000 |
commit | f47fe829dd722b502a186b9c437cf8f57bf55405 (patch) | |
tree | b31c285cd9130122916d73d36ae47ffdf05f1c5f /src | |
parent | 658e02a6214d75f7fec8de5007c1644aaef568d9 (diff) | |
download | tor-f47fe829dd722b502a186b9c437cf8f57bf55405.tar tor-f47fe829dd722b502a186b9c437cf8f57bf55405.tar.gz |
avoid racing the mark-for-close when the client hangs up on us
at the same time we get an end relay cell.
(thanks to wmf for reminding me)
svn:r2181
Diffstat (limited to 'src')
-rw-r--r-- | src/or/connection_edge.c | 6 | ||||
-rw-r--r-- | src/or/relay.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index f8cdbe139..6dec49e9f 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -54,7 +54,11 @@ int connection_edge_process_inbuf(connection_t *conn) { /* eof reached, kill it. */ log_fn(LOG_INFO,"conn (fd %d) reached eof. Closing.", conn->s); connection_edge_end(conn, END_STREAM_REASON_DONE, conn->cpath_layer); - connection_mark_for_close(conn); + if(!conn->marked_for_close) { + /* only mark it if not already marked. it's possible to + * get the 'end' right around when the client hangs up on us. */ + connection_mark_for_close(conn); + } conn->hold_open_until_flushed = 1; /* just because we shouldn't read doesn't mean we shouldn't write */ return 0; diff --git a/src/or/relay.c b/src/or/relay.c index e95235f89..b74a3401b 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -694,7 +694,11 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, #else /* We just *got* an end; no reason to send one. */ conn->has_sent_end = 1; - connection_mark_for_close(conn); + if(!conn->marked_for_close) { + /* only mark it if not already marked. it's possible to + * get the 'end' right around when the client hangs up on us. */ + connection_mark_for_close(conn); + } conn->hold_open_until_flushed = 1; #endif return 0; |