Browse Source

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
commit
94f2f320a6
2 changed files with 7 additions and 16 deletions
  1. +7
    -13
      daemon/call.c
  2. +0
    -3
      daemon/call.h

+ 7
- 13
daemon/call.c View File

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


+ 0
- 3
daemon/call.h View File

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


Loading…
Cancel
Save