From bb054ec00b9e374a96e5171de079ad10140e6e55 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 21 Sep 2012 15:05:02 +0000 Subject: [PATCH] fix more locking problems --- daemon/call.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/call.c b/daemon/call.c index fb87ca87e..b01a86f53 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1206,6 +1206,7 @@ found: DBG("creating new callstream"); cs = callstream_new(c, t->num); + mutex_lock(&cs->lock); if (!r) { /* nothing found to re-use, open new ports */ @@ -1229,6 +1230,7 @@ found: mutex_unlock(&cs_o->lock); } + mutex_unlock(&cs->lock); g_queue_push_tail(q, cs); /* hand over the ref of new cs */ ZERO(c->lookup_done); continue; @@ -1297,8 +1299,8 @@ got_cs: mutex_unlock(&cs_o->lock); cs_o = cs; cs = callstream_new(c, t->num); - callstream_init(cs, 0, 0); mutex_lock(&cs->lock); + callstream_init(cs, 0, 0); steal_peer(&cs->peers[0], &cs_o->peers[0]); p = &cs->peers[1]; setup_peer(p, t, tag);