diff options
author | Max Kellermann <max@duempel.org> | 2011-08-25 18:48:05 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-08-25 18:48:05 +0200 |
commit | 5068227a4684ba053db27e297ffb498e590f3e0d (patch) | |
tree | 0f78679b303e2753f1bb296ab18b0a71e7cc2296 /src/input | |
parent | f8f3bc89e788faf8eea979065f532120ce631a75 (diff) | |
download | mpd-5068227a4684ba053db27e297ffb498e590f3e0d.tar.gz mpd-5068227a4684ba053db27e297ffb498e590f3e0d.tar.xz mpd-5068227a4684ba053db27e297ffb498e590f3e0d.zip |
input/curl: move code to input_curl_flush_buffers()
Allow closing the handle while preserving the remaining buffers.
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/curl_input_plugin.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c index c3256103d..e5e5cd941 100644 --- a/src/input/curl_input_plugin.c +++ b/src/input/curl_input_plugin.c @@ -181,6 +181,13 @@ buffer_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data) g_free(data); } +static void +input_curl_flush_buffers(struct input_curl *c) +{ + g_queue_foreach(c->buffers, buffer_free_callback, NULL); + g_queue_clear(c->buffers); +} + /** * Frees the current "libcurl easy" handle, and everything associated * with it. @@ -199,9 +206,6 @@ input_curl_easy_free(struct input_curl *c) g_free(c->range); c->range = NULL; - - g_queue_foreach(c->buffers, buffer_free_callback, NULL); - g_queue_clear(c->buffers); } /** @@ -215,6 +219,7 @@ input_curl_free(struct input_curl *c) g_free(c->meta_name); input_curl_easy_free(c); + input_curl_flush_buffers(c); if (c->multi != NULL) curl_multi_cleanup(c->multi); @@ -797,6 +802,7 @@ input_curl_seek(struct input_stream *is, goffset offset, int whence, /* close the old connection and open a new one */ input_curl_easy_free(c); + input_curl_flush_buffers(c); is->offset = offset; if (is->offset == is->size) { |