From 29241c4f835797f635816a9f37528aa981f722b5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 16 Sep 2011 21:06:12 +0200 Subject: input_plugin: add method check() To check for errors without reading. The decoder thread wants to do that, before it passes the input stream to the plugin. --- src/input/curl_input_plugin.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/input/curl_input_plugin.c') diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c index 824fc9bad..4f3e9c6e4 100644 --- a/src/input/curl_input_plugin.c +++ b/src/input/curl_input_plugin.c @@ -774,6 +774,23 @@ input_curl_free(struct input_curl *c) g_free(c); } +static bool +input_curl_check(struct input_stream *is, GError **error_r) +{ + struct input_curl *c = (struct input_curl *)is; + + g_mutex_lock(c->mutex); + + bool success = c->postponed_error == NULL; + if (!success) { + g_propagate_error(error_r, c->postponed_error); + c->postponed_error = NULL; + } + + g_mutex_unlock(c->mutex); + return success; +} + static struct tag * input_curl_tag(struct input_stream *is) { @@ -1318,6 +1335,7 @@ const struct input_plugin input_plugin_curl = { .open = input_curl_open, .close = input_curl_close, + .check = input_curl_check, .tag = input_curl_tag, .buffer = input_curl_buffer, .read = input_curl_read, -- cgit v1.2.3