diff --git a/include/re_turn.h b/include/re_turn.h index 17c2fda..3ee65c7 100644 --- a/include/re_turn.h +++ b/include/re_turn.h @@ -12,6 +12,7 @@ enum { typedef void(turnc_h)(int err, uint16_t scode, const char *reason, const struct sa *relay_addr, const struct sa *mapped_addr, + const struct stun_msg *msg, void *arg); typedef void(turnc_perm_h)(void *arg); typedef void(turnc_chan_h)(void *arg); diff --git a/src/ice/gather.c b/src/ice/gather.c index 25f092d..0ca0389 100644 --- a/src/ice/gather.c +++ b/src/ice/gather.c @@ -114,11 +114,12 @@ static int send_binding_request(struct icem *icem, struct icem_comp *comp) static void turnc_handler(int err, uint16_t scode, const char *reason, const struct sa *relay, const struct sa *mapped, - void *arg) + const struct stun_msg *msg, void *arg) { struct icem_comp *comp = arg; struct icem *icem = comp->icem; struct cand *lcand; + (void)msg; --icem->nstun; diff --git a/src/turn/chan.c b/src/turn/chan.c index 3535201..2a6cf70 100644 --- a/src/turn/chan.c +++ b/src/turn/chan.c @@ -96,7 +96,8 @@ static void timeout(void *arg) err = chanbind_request(chan, true); if (err) - chan->turnc->th(err, 0, NULL, NULL, NULL, chan->turnc->arg); + chan->turnc->th(err, 0, NULL, NULL, NULL, NULL, + chan->turnc->arg); } @@ -136,7 +137,7 @@ static void chanbind_resp_handler(int err, uint16_t scode, const char *reason, } out: - chan->turnc->th(err, scode, reason, NULL, NULL, chan->turnc->arg); + chan->turnc->th(err, scode, reason, NULL, NULL, msg, chan->turnc->arg); } diff --git a/src/turn/perm.c b/src/turn/perm.c index 566fa48..c80650a 100644 --- a/src/turn/perm.c +++ b/src/turn/perm.c @@ -70,7 +70,8 @@ static void timeout(void *arg) err = createperm_request(perm, true); if (err) - perm->turnc->th(err, 0, NULL, NULL, NULL, perm->turnc->arg); + perm->turnc->th(err, 0, NULL, NULL, NULL, NULL, + perm->turnc->arg); } @@ -111,7 +112,7 @@ static void createperm_resp_handler(int err, uint16_t scode, } out: - perm->turnc->th(err, scode, reason, NULL, NULL, perm->turnc->arg); + perm->turnc->th(err, scode, reason, NULL, NULL, msg, perm->turnc->arg); } diff --git a/src/turn/turnc.c b/src/turn/turnc.c index 9f178e9..c96758c 100644 --- a/src/turn/turnc.c +++ b/src/turn/turnc.c @@ -73,7 +73,7 @@ static void timeout(void *arg) err = refresh_request(turnc, turnc->lifetime, true, refresh_resp_handler, turnc); if (err) - turnc->th(err, 0, NULL, NULL, NULL, turnc->arg); + turnc->th(err, 0, NULL, NULL, NULL, NULL, turnc->arg); } @@ -116,6 +116,9 @@ static void allocate_resp_handler(int err, uint16_t scode, const char *reason, break; case 300: + if (turnc->proto == IPPROTO_TCP) + break; + alt = stun_msg_attr(msg, STUN_ATTR_ALT_SERVER); if (!alt) break; @@ -149,6 +152,7 @@ static void allocate_resp_handler(int err, uint16_t scode, const char *reason, turnc->th(err, scode, reason, rel ? &rel->v.xor_relay_addr : NULL, map ? &map->v.xor_mapped_addr : NULL, + msg, turnc->arg); } @@ -206,7 +210,7 @@ static void refresh_resp_handler(int err, uint16_t scode, const char *reason, } out: - turnc->th(err, scode, reason, NULL, NULL, turnc->arg); + turnc->th(err, scode, reason, NULL, NULL, msg, turnc->arg); }