summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2012-10-23 02:51:31 +0300
committerNick Mathewson <nickm@torproject.org>2012-11-06 17:53:09 -0500
commita9f786758dc59ee28fbbd16228e38ff9ba1bc7a9 (patch)
tree73ecdda4e8680be73f8feb35eeed171ca1d89b9f
parent39a0a2c3ae8c93ceed42f6d2d1143002c231fc16 (diff)
downloadtor-a9f786758dc59ee28fbbd16228e38ff9ba1bc7a9.tar.gz
tor-a9f786758dc59ee28fbbd16228e38ff9ba1bc7a9.zip
Add warning message when a managed proxy dies during configuration.
-rw-r--r--changes/bug71954
-rw-r--r--src/common/util.c19
-rw-r--r--src/common/util.h2
-rw-r--r--src/or/transports.c9
4 files changed, 33 insertions, 1 deletions
diff --git a/changes/bug7195 b/changes/bug7195
new file mode 100644
index 0000000000..86ddeca396
--- /dev/null
+++ b/changes/bug7195
@@ -0,0 +1,4 @@
+ o Minor bugfixes:
+ - Add warning message when a managed proxy dies during
+ configuration. Fixes bug 7195; bugfix on 0.2.4.2-alpha.
+
diff --git a/src/common/util.c b/src/common/util.c
index 75eb233bef..1b0603a469 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -4461,6 +4461,25 @@ tor_split_lines(smartlist_t *sl, char *buf, int len)
return smartlist_len(sl);
}
+/** Return a string corresponding to <b>stream_status</b>. */
+const char *
+stream_status_to_string(enum stream_status stream_status)
+{
+ switch (stream_status) {
+ case IO_STREAM_OKAY:
+ return "okay";
+ case IO_STREAM_EAGAIN:
+ return "temporarily unavailable";
+ case IO_STREAM_TERM:
+ return "terminated";
+ case IO_STREAM_CLOSED:
+ return "closed";
+ default:
+ tor_fragile_assert();
+ return "unknown";
+ }
+}
+
#ifdef _WIN32
/** Return a smartlist containing lines outputted from
diff --git a/src/common/util.h b/src/common/util.h
index aa2087b013..fabfdb19fd 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -307,6 +307,8 @@ enum stream_status {
IO_STREAM_CLOSED
};
+const char *stream_status_to_string(enum stream_status stream_status);
+
enum stream_status get_string_from_pipe(FILE *stream, char *buf, size_t count);
/** Return values from file_status(); see that function's documentation
diff --git a/src/or/transports.c b/src/or/transports.c
index a532f87502..0319071097 100644
--- a/src/or/transports.c
+++ b/src/or/transports.c
@@ -614,8 +614,15 @@ configure_proxy(managed_proxy_t *mp)
tor_get_lines_from_handle(tor_process_get_stdout_pipe(mp->process_handle),
&stream_status);
if (!proxy_output) { /* failed to get input from proxy */
- if (stream_status != IO_STREAM_EAGAIN)
+ if (stream_status != IO_STREAM_EAGAIN) { /* bad stream status! */
mp->conf_state = PT_PROTO_BROKEN;
+ log_warn(LD_GENERAL, "The communication stream of managed proxy '%s' "
+ "is '%s'. Most probably the managed proxy stopped running. "
+ "This might be a bug of the managed proxy, a bug of Tor, or "
+ "a misconfiguration. Please enable logging on your managed "
+ "proxy and check the logs for errors.",
+ mp->argv[0], stream_status_to_string(stream_status));
+ }
goto done;
}