diff options
Diffstat (limited to 'src/input/soup_input_plugin.c')
-rw-r--r-- | src/input/soup_input_plugin.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/input/soup_input_plugin.c b/src/input/soup_input_plugin.c index 7f92113b4..12ede3a29 100644 --- a/src/input/soup_input_plugin.c +++ b/src/input/soup_input_plugin.c @@ -220,6 +220,17 @@ input_soup_wait_data(struct input_soup *s) } } +static gpointer +input_soup_queue(gpointer data) +{ + struct input_soup *s = data; + + soup_session_queue_message(soup_session, s->msg, + input_soup_session_callback, s); + + return NULL; +} + static struct input_stream * input_soup_open(const char *uri, G_GNUC_UNUSED GError **error_r) { @@ -255,12 +266,23 @@ input_soup_open(const char *uri, G_GNUC_UNUSED GError **error_r) s->completed = false; s->postponed_error = NULL; - soup_session_queue_message(soup_session, s->msg, - input_soup_session_callback, s); + io_thread_call(input_soup_queue, s); return &s->base; } +static gpointer +input_soup_cancel(gpointer data) +{ + struct input_soup *s = data; + + if (!s->completed) + soup_session_cancel_message(soup_session, s->msg, + SOUP_STATUS_CANCELLED); + + return NULL; +} + static void input_soup_close(struct input_stream *is) { @@ -274,8 +296,7 @@ input_soup_close(struct input_stream *is) g_mutex_unlock(s->mutex); - soup_session_cancel_message(soup_session, s->msg, - SOUP_STATUS_CANCELLED); + io_thread_call(input_soup_cancel, s); g_mutex_lock(s->mutex); while (!s->completed) |