summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-05-12 18:41:32 +0000
committerRoger Dingledine <arma@torproject.org>2004-05-12 18:41:32 +0000
commit4c9138d6406285077c3fc527f181610cd81b5727 (patch)
tree5c3f6a67cd30658c8aa025cb69b5d39e70721028
parent9eee0fadc3a5dca80b354d1f386e5c18a353c501 (diff)
downloadtor-4c9138d6406285077c3fc527f181610cd81b5727.tar.gz
tor-4c9138d6406285077c3fc527f181610cd81b5727.zip
calling flush_buf and not checking for return value is bad
svn:r1851
-rw-r--r--src/or/main.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 65be5363ef..a2150eb919 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -351,15 +351,21 @@ static void run_connection_housekeeping(int i, time_t now) {
if(conn->type == CONN_TYPE_DIR &&
!conn->marked_for_close &&
conn->timestamp_lastwritten + 5*60 < now) {
- log_fn(LOG_WARN,"Expiring wedged directory conn (purpose %d)", conn->purpose);
+ log_fn(LOG_WARN,"Expiring wedged directory conn (fd %d, purpose %d)", conn->s, conn->purpose);
/* XXXX This next check may help isolate where the pesky EPIPE bug
* really occurs. */
if (connection_wants_to_flush(conn)) {
- flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen);
+ if(flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen) < 0) {
+ log_fn(LOG_WARN,"flushing expired directory conn failed.");
+ connection_close_immediate(conn);
+ connection_mark_for_close(conn,0);
+ /* */
+ } else {
+ /* XXXX Does this next part make sense, really? */
+ connection_mark_for_close(conn,0);
+ conn->hold_open_until_flushed = 1; /* give it a last chance */
+ }
}
- connection_mark_for_close(conn,0);
- /* XXXX Does this next part make sense, really? */
- conn->hold_open_until_flushed = 1; /* give it a last chance */
return;
}