aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-15 19:06:14 +0100
committerMax Kellermann <max@duempel.org>2009-03-15 19:06:14 +0100
commit870706519a2abf3a345ddaa149ebe148d7971c76 (patch)
tree754fb16bc57a4ab647d9d40e5b548718010552fb /src
parent58844aabac6407a95a8c2fb5ad22f969628c6bed (diff)
downloadmpd-870706519a2abf3a345ddaa149ebe148d7971c76.tar.gz
mpd-870706519a2abf3a345ddaa149ebe148d7971c76.tar.xz
mpd-870706519a2abf3a345ddaa149ebe148d7971c76.zip
httpd_output: check client->write_source_id in handler
Due to a race condition, httpd_client_out_event() could be called even when its GLib event source was already removed. Check that case.
Diffstat (limited to '')
-rw-r--r--src/output/httpd_client.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/output/httpd_client.c b/src/output/httpd_client.c
index 6f87b972a..266a207cc 100644
--- a/src/output/httpd_client.c
+++ b/src/output/httpd_client.c
@@ -459,6 +459,13 @@ httpd_client_out_event(GIOChannel *source,
assert(condition == G_IO_OUT);
assert(client->state == RESPONSE);
+ if (client->write_source_id == 0) {
+ /* another thread has removed the event source while
+ this thread was waiting for httpd->mutex */
+ g_mutex_unlock(httpd->mutex);
+ return false;
+ }
+
if (client->current_page == NULL) {
client->current_page = g_queue_pop_head(client->pages);
client->current_position = 0;