actually the call struct needs neither linked flag nor shutdown flag due to the sequence of events and locking

git.mgm/mediaproxy-ng/2.1
Richard Fuchs 14 years ago
parent d8776907f8
commit 94f2f320a6

@ -1327,26 +1327,21 @@ static void kill_callstream(struct callstream *s) {
static void call_destroy(struct call *c) {
struct callmaster *m = c->callmaster;
struct callstream *s;
int ret;
restart:
rwlock_lock_w(&m->hashlock);
if (c->linked) {
if (!g_hash_table_remove(m->callhash, c->callid)) {
rwlock_unlock_w(&m->hashlock);
goto restart;
}
c->linked = 0;
obj_put(c);
}
ret = g_hash_table_remove(m->callhash, c->callid);
rwlock_unlock_w(&m->hashlock);
if (!ret)
return;
obj_put(c);
if (redis_delete)
redis_delete(c, m->conf.redis);
mutex_lock(&c->lock);
if (c->shutdown)
goto out;
c->shutdown = 1;
mylog(LOG_INFO, LOG_PREFIX_C "Final packet stats:", c->callid);
while (c->callstreams->head) {
s = g_queue_pop_head(c->callstreams);
@ -1374,7 +1369,6 @@ restart:
obj_put(s);
mutex_lock(&c->lock);
}
out:
mutex_unlock(&c->lock);
}

@ -93,9 +93,6 @@ struct call {
time_t created;
GHashTable *infohash;
time_t lookup_done;
int linked:1;
int shutdown:1;
};
struct callmaster_config {

Loading…
Cancel
Save