From a9f786758dc59ee28fbbd16228e38ff9ba1bc7a9 Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Tue, 23 Oct 2012 02:51:31 +0300 Subject: Add warning message when a managed proxy dies during configuration. --- src/common/util.c | 19 +++++++++++++++++++ src/common/util.h | 2 ++ 2 files changed, 21 insertions(+) (limited to 'src/common') diff --git a/src/common/util.c b/src/common/util.c index 75eb233be..1b0603a46 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 stream_status. */ +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 aa2087b01..fabfdb19f 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 -- cgit v1.2.3