[or-cvs] Give more useful log messages when the tor process closes d...
Nick Mathewson
nickm at seul.org
Wed Jan 19 21:34:44 UTC 2005
Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv21643/src/or
Modified Files:
cpuworker.c dns.c
Log Message:
Give more useful log messages when the tor process closes dns/cpuworker connections. "Error: Success!" makes us seem like crazy people."
Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/cpuworker.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- cpuworker.c 3 Jan 2005 19:07:25 -0000 1.63
+++ cpuworker.c 19 Jan 2005 21:34:42 -0000 1.64
@@ -220,10 +220,16 @@
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);
Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- dns.c 4 Jan 2005 11:26:08 -0000 1.130
+++ dns.c 19 Jan 2005 21:34:42 -0000 1.131
@@ -673,10 +673,15 @@
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();
}
More information about the tor-commits
mailing list