aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/output/httpd_client.c13
-rw-r--r--src/output/httpd_client.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/src/output/httpd_client.c b/src/output/httpd_client.c
index fb3f0548a..6f87b972a 100644
--- a/src/output/httpd_client.c
+++ b/src/output/httpd_client.c
@@ -409,13 +409,24 @@ httpd_client_queue_size(const struct httpd_client *client)
return size;
}
+/* g_queue_clear() was introduced in GLib 2.14 */
+#if !GLIB_CHECK_VERSION(2,14,0)
+#define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0)
+#endif
+
void
-httpd_client_cancel(const struct httpd_client *client)
+httpd_client_cancel(struct httpd_client *client)
{
if (client->state != RESPONSE)
return;
g_queue_foreach(client->pages, httpd_client_unref_page, NULL);
+ g_queue_clear(client->pages);
+
+ if (client->write_source_id != 0 && client->current_page == NULL) {
+ g_source_remove(client->write_source_id);
+ client->write_source_id = 0;
+ }
}
static GIOStatus
diff --git a/src/output/httpd_client.h b/src/output/httpd_client.h
index 56a0203a3..c81cdb12f 100644
--- a/src/output/httpd_client.h
+++ b/src/output/httpd_client.h
@@ -54,7 +54,7 @@ httpd_client_queue_size(const struct httpd_client *client);
* Clears the page queue.
*/
void
-httpd_client_cancel(const struct httpd_client *client);
+httpd_client_cancel(struct httpd_client *client);
/**
* Appends a page to the client's queue.