diff options
author | Roger Dingledine <arma@torproject.org> | 2004-11-21 10:14:57 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-11-21 10:14:57 +0000 |
commit | 310a8da0d2ef457a245843268677f50c6ea84a98 (patch) | |
tree | bc735fce476d9c687c9aa19bdfd93963fbad874c /src/or/dns.c | |
parent | 671d84dc2f02d8d39f66582add2324ecb2590728 (diff) | |
download | tor-310a8da0d2ef457a245843268677f50c6ea84a98.tar tor-310a8da0d2ef457a245843268677f50c6ea84a98.tar.gz |
break reached_eof() out of process_inbuf()
svn:r2930
Diffstat (limited to 'src/or/dns.c')
-rw-r--r-- | src/or/dns.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index 8e6dfca5e..7593d2cf0 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -559,8 +559,18 @@ int connection_dns_finished_flushing(connection_t *conn) { return 0; } -/** Read handler: called when we get data from a dnsworker. If the - * connection is closed, mark the dnsworker as dead. Otherwise, see +int connection_dns_reached_eof(connection_t *conn) { + log_fn(LOG_WARN,"Read eof. Worker died unexpectedly."); + if(conn->state == DNSWORKER_STATE_BUSY) { + dns_cancel_pending_resolve(conn->address); + num_dnsworkers_busy--; + } + num_dnsworkers--; + connection_mark_for_close(conn); + return 0; +} + +/** Read handler: called when we get data from a dnsworker. See * if we have a complete answer. If so, call dns_found_answer on the * result. If not, wait. Returns 0. */ int connection_dns_process_inbuf(connection_t *conn) { @@ -570,17 +580,6 @@ int connection_dns_process_inbuf(connection_t *conn) { tor_assert(conn); tor_assert(conn->type == CONN_TYPE_DNSWORKER); - if(conn->inbuf_reached_eof) { - log_fn(LOG_WARN,"Read eof. Worker died unexpectedly."); - if(conn->state == DNSWORKER_STATE_BUSY) { - dns_cancel_pending_resolve(conn->address); - num_dnsworkers_busy--; - } - num_dnsworkers--; - connection_mark_for_close(conn); - return 0; - } - if(conn->state != DNSWORKER_STATE_BUSY) { log_fn(LOG_WARN,"Bug: poll() indicated than an idle dns worker was readable. Please report."); return 0; |