summaryrefslogtreecommitdiff
path: root/modules/ice
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-09-15 21:01:17 +0200
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-09-15 21:01:17 +0200
commit939a56fe68f696d5397b656cca698fd4e011bee4 (patch)
treecefffa9c4ceceb92a506e0d235d3e2a32d867b3e /modules/ice
parentdacf1e515f57f5f0e57fa61d69084ee40f959574 (diff)
ice: call handler once on errors
Diffstat (limited to 'modules/ice')
-rw-r--r--modules/ice/ice.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/ice/ice.c b/modules/ice/ice.c
index 36d5c20..374aeb5 100644
--- a/modules/ice/ice.c
+++ b/modules/ice/ice.c
@@ -65,6 +65,7 @@ struct mnat_media {
struct sdp_media *sdpm;
struct icem *icem;
bool complete;
+ bool terminated;
int nstun; /**< Number of pending STUN candidates */
};
@@ -122,10 +123,14 @@ static void stun_resp_handler(int err, uint16_t scode, const char *reason,
struct stun_attr *attr;
struct ice_cand *lcand;
+ if (m->terminated)
+ return;
+
--m->nstun;
if (err || scode > 0) {
- warning("STUN Request failed: %m\n", err);
+ warning("ice: comp %u: STUN Request failed: %m\n",
+ comp->id, err);
goto out;
}
@@ -364,6 +369,8 @@ static void media_destructor(void *arg)
struct mnat_media *m = arg;
unsigned i;
+ m->terminated = true;
+
list_unlink(&m->le);
mem_deref(m->sdpm);
mem_deref(m->icem);
@@ -647,6 +654,7 @@ static void gather_handler(int err, uint16_t scode, const char *reason,
void *arg)
{
struct mnat_media *m = arg;
+ mnat_estab_h *estabh = m->sess->estabh;
if (err || scode) {
warning("ice: gather error: %m (%u %s)\n",
@@ -667,7 +675,11 @@ static void gather_handler(int err, uint16_t scode, const char *reason,
return;
}
- m->sess->estabh(err, scode, reason, m->sess->arg);
+ if (err || scode)
+ m->sess->estabh = NULL;
+
+ if (estabh)
+ estabh(err, scode, reason, m->sess->arg);
}