summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-01-19 21:34:42 +0000
committerNick Mathewson <nickm@torproject.org>2005-01-19 21:34:42 +0000
commite0bf5976658ea76cd8b61d67f957b3c4f68e9108 (patch)
treefa32e3a61309b2691e2ecb3cff2c69df5ab20a53 /src
parent75d83827e0374252bd5c91cbfa0b67e36ad70741 (diff)
downloadtor-e0bf5976658ea76cd8b61d67f957b3c4f68e9108.tar.gz
tor-e0bf5976658ea76cd8b61d67f957b3c4f68e9108.zip
Give more useful log messages when the tor process closes dns/cpuworker connections. "Error: Success!" makes us seem like crazy people."
svn:r3373
Diffstat (limited to 'src')
-rw-r--r--src/or/cpuworker.c10
-rw-r--r--src/or/dns.c11
2 files changed, 16 insertions, 5 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 6222300312..4ca69c2293 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -220,10 +220,16 @@ static int cpuworker_main(void *data) {
dup_onion_keys(&onion_key, &last_onion_key);
for (;;) {
+ int r;
- if (recv(fd, &question_type, 1, 0) != 1) {
+ if ((r = recv(fd, &question_type, 1, 0)) != 1) {
// log_fn(LOG_ERR,"read type failed. Exiting.");
- log_fn(LOG_INFO,"cpuworker exiting because tor process closed connection (either rotated keys or died).");
+ if (r == 0) {
+ log_fn(LOG_INFO,"CPU worker exiting because Tor process closed connection (either rotated keys or died).");
+ } else {
+ log_fn(LOG_INFO,"CPU worker editing because of error on connection To Tor process.");
+ log_fn(LOG_INFO,"(Error on %d was %s)", fd, tor_socket_strerror(tor_socket_errno(fd)));
+ }
goto end;
}
tor_assert(question_type == CPUWORKER_TASK_ONION);
diff --git a/src/or/dns.c b/src/or/dns.c
index e70b277c36..dfa6876d91 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -673,10 +673,15 @@ static int dnsworker_main(void *data) {
tor_free(data);
for (;;) {
+ int r;
- if (recv(fd, &address_len, 1, 0) != 1) {
- log_fn(LOG_INFO,"dnsworker exiting because tor process closed connection (either pruned idle dnsworker or died).");
- log_fn(LOG_INFO,"Error on %d was %s", fd, tor_socket_strerror(tor_socket_errno(fd)));
+ if ((r = recv(fd, &address_len, 1, 0)) != 1) {
+ if (r == 0) {
+ log_fn(LOG_INFO,"DNS worker exiting because Tor process closed connection (either pruned idle dnsworker or died).");
+ } else {
+ log_fn(LOG_INFO,"DNS worker exiting because of error on connection to Tor process.");
+ log_fn(LOG_INFO,"(Error on %d was %s)", fd, tor_socket_strerror(tor_socket_errno(fd)));
+ }
spawn_exit();
}