From 4cb63b5edfd9508aa069b4a5dba32e7fa524effc Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 3 Aug 2012 15:49:04 +0000 Subject: [PATCH] need to handle the no-reply case to avoid deadlocks with bad cookies --- daemon/control_udp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/daemon/control_udp.c b/daemon/control_udp.c index b1143f28c..d040983e2 100644 --- a/daemon/control_udp.c +++ b/daemon/control_udp.c @@ -173,10 +173,18 @@ restart: mutex_lock(&u->lock); g_hash_table_replace(u->fresh_cookies, g_string_chunk_insert(u->fresh_chunks, out[RE_UDP_COOKIE]), g_string_chunk_insert(u->fresh_chunks, reply)); + g_hash_table_remove(u->stale_cookies, out[RE_UDP_COOKIE]); cond_broadcast(&u->cond); mutex_unlock(&u->lock); free(reply); } + else { + mutex_lock(&u->lock); + g_hash_table_remove(u->fresh_cookies, out[RE_UDP_COOKIE]); + g_hash_table_remove(u->stale_cookies, out[RE_UDP_COOKIE]); + cond_broadcast(&u->cond); + mutex_unlock(&u->lock); + } out: pcre_free(out);