From ffc3ad88598db17741e800edc31c5c8c79b27349 Mon Sep 17 00:00:00 2001 From: Richard Aas Date: Fri, 28 Jan 2011 12:09:54 +0000 Subject: [PATCH] ice: destroy turnc if turn gathering fails --- src/ice/gather.c | 5 +++++ src/ice/icem.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ice/gather.c b/src/ice/gather.c index 4f119f0..236dba1 100644 --- a/src/ice/gather.c +++ b/src/ice/gather.c @@ -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)); diff --git a/src/ice/icem.c b/src/ice/icem.c index 5119fda..1072758 100644 --- a/src/ice/icem.c +++ b/src/ice/icem.c @@ -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; }