Browse Source

fix a silly, threading-unrelated, statistics-skewing bug

git.mgm/mediaproxy-ng/2.1
Richard Fuchs 14 years ago
parent
commit
ab3b8c60f0
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      daemon/call.c

+ 9
- 3
daemon/call.c View File

@ -490,6 +490,7 @@ static void call_timer_iterator(void *key, void *val, void *ptr) {
struct callmaster *cm; struct callmaster *cm;
unsigned int check; unsigned int check;
struct streamrelay *sr; struct streamrelay *sr;
int good = 0;
mutex_lock(&c->lock); mutex_lock(&c->lock);
@ -509,6 +510,9 @@ static void call_timer_iterator(void *key, void *val, void *ptr) {
hlp->ports[sr->localport] = sr; hlp->ports[sr->localport] = sr;
obj_hold(cs); obj_hold(cs);
if (good)
continue;
check = cm->conf.timeout; check = cm->conf.timeout;
if (!sr->peer.port) if (!sr->peer.port)
check = cm->conf.silent_timeout; check = cm->conf.silent_timeout;
@ -516,12 +520,15 @@ static void call_timer_iterator(void *key, void *val, void *ptr) {
check = cm->conf.silent_timeout; check = cm->conf.silent_timeout;
if (poller_now - sr->last < check) if (poller_now - sr->last < check)
goto good;
good = 1;
} }
} }
mutex_unlock(&cs->lock); mutex_unlock(&cs->lock);
} }
if (good)
goto out;
mylog(LOG_INFO, LOG_PREFIX_C "Closing call branch due to timeout", mylog(LOG_INFO, LOG_PREFIX_C "Closing call branch due to timeout",
LOG_PARAMS_C(c)); LOG_PARAMS_C(c));
@ -530,8 +537,7 @@ drop:
hlp->del = g_slist_prepend(hlp->del, obj_get(c)); hlp->del = g_slist_prepend(hlp->del, obj_get(c));
return; return;
good:
mutex_unlock(&cs->lock);
out:
mutex_unlock(&c->lock); mutex_unlock(&c->lock);
} }


Loading…
Cancel
Save