Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Jul 10, 2023
1 parent bbba96f commit cfdf239
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions src/ice/icesdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ static int media_pwd_decode(struct icem *icem, const char *value)

static int getaddr_rcand(void *arg)
{
struct rcand *rcand = arg;
int err;
struct rcand *rcand = arg;
struct addrinfo *res = NULL;
struct addrinfo hints;
int err;

memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
Expand Down Expand Up @@ -298,33 +298,31 @@ static int cand_decode(struct icem *icem, const char *val)

(void)pl_strcpy(&cand_type, type, sizeof(type));
cid = pl_u32(&compid);
DEBUG_WARNING("DNS\n");

err = sa_set(&caddr, &addr, pl_u32(&port));
if (err) {
/* try getaddr resolution */
if (err == EINVAL) {
struct rcand *rcand =
mem_zalloc(sizeof(struct rcand), rcand_dealloc);
if (!rcand)
return ENOMEM;


rcand->icem = mem_ref(icem);
rcand->type = ice_cand_name2type(type);
rcand->cid = cid;
rcand->prio = pl_u32(&prio);
rcand->rel_addr = rel_addr;

pl_dup(rcand->foundation, &foundation);
(void)pl_strcpy(&addr, rcand->domain,
sizeof(rcand->domain));

err = re_thread_async(getaddr_rcand, delayed_rcand,
rcand);
if (err)
mem_deref(rcand);
}
if (err != EINVAL)
return err;

/* try non blocking getaddr mdns resolution */
struct rcand *rcand =
mem_zalloc(sizeof(struct rcand), rcand_dealloc);
if (!rcand)
return ENOMEM;

rcand->icem = mem_ref(icem);
rcand->type = ice_cand_name2type(type);
rcand->cid = cid;
rcand->prio = pl_u32(&prio);
rcand->rel_addr = rel_addr;

pl_dup(rcand->foundation, &foundation);
(void)pl_strcpy(&addr, rcand->domain, sizeof(rcand->domain));

err = re_thread_async(getaddr_rcand, delayed_rcand, rcand);
if (err)
mem_deref(rcand);

return err;
}

Expand Down

0 comments on commit cfdf239

Please sign in to comment.