]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add warning message when a managed proxy dies during configuration.
authorGeorge Kadianakis <desnacked@riseup.net>
Mon, 22 Oct 2012 23:51:31 +0000 (02:51 +0300)
committerNick Mathewson <nickm@torproject.org>
Tue, 6 Nov 2012 22:53:09 +0000 (17:53 -0500)
changes/bug7195 [new file with mode: 0644]
src/common/util.c
src/common/util.h
src/or/transports.c

diff --git a/changes/bug7195 b/changes/bug7195
new file mode 100644 (file)
index 0000000..86ddeca
--- /dev/null
@@ -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.
+
index 75eb233bef987268c80bf99ab2e2c56e1b33a905..1b0603a469fafadaf50cdef5eac77e7bed61250c 100644 (file)
@@ -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
index aa2087b013420166b1a11c19f61902156f56db28..fabfdb19fd9eaa5a93faf8e7c7c82f4c5263f78f 100644 (file)
@@ -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
index a532f87502a5e90f4c65a24d3c29c916a0019848..0319071097fee3147afa90ad12e4b193617606f0 100644 (file)
@@ -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;
   }