ice: destroy turnc if turn gathering fails

This commit is contained in:
Richard Aas 2011-01-28 12:09:54 +00:00
parent 3777efae20
commit ffc3ad8859
2 changed files with 9 additions and 1 deletions

View file

@ -122,6 +122,11 @@ static void turnc_handler(int err, uint16_t scode, const char *reason,
--icem->nstun;
/* TURN failed, so we destroy the client */
if (err || scode) {
comp->turnc = mem_deref(comp->turnc);
}
if (err) {
DEBUG_WARNING("{%s.%d} TURN Client error: %s\n",
icem->name, comp->id, strerror(err));

View file

@ -214,7 +214,10 @@ int icem_add_chan(struct icem *icem, uint8_t compid, const struct sa *raddr)
if (!comp)
return ENOENT;
return turnc_add_chan(comp->turnc, raddr, NULL, NULL);
if (comp->turnc)
return turnc_add_chan(comp->turnc, raddr, NULL, NULL);
return 0;
}