Skip to content

Commit

Permalink
incorporate PR remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianfridrich committed Jul 8, 2022
1 parent acbe394 commit 20c7f26
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/sip/strans.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,11 @@ int sip_strans_reply(struct sip_strans **stp, struct sip *sip,
}
else if (scode < 300) {
tmr_start(&st->tmr, 64 * SIP_T1, tmr_handler, st);
if (pl_strcmp(&msg->met, "PRACK"))
st->state = ACCEPTED;
st->state = ACCEPTED;
}
else {
tmr_start(&st->tmr, 64 * SIP_T1, tmr_handler, st);
if (pl_strcmp(&msg->met, "PRACK"))
st->state = COMPLETED;
st->state = COMPLETED;

if (!sip_transp_reliable(st->msg->tp))
tmr_start(&st->tmrg, SIP_T1,
Expand Down
14 changes: 4 additions & 10 deletions src/sipsess/accept.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ static void cancel_handler(void *arg)
{
struct sipsess *sess = arg;

(void)sip_treply(&sess->st, sess->sip, sess->msg, 487,
"Request Terminated");
(void)sip_treply(&sess->st, sess->sip, sess->msg,
487, "Request Terminated");

sess->peerterm = true;

Expand Down Expand Up @@ -229,14 +229,8 @@ int sipsess_reject(struct sipsess *sess, uint16_t scode, const char *reason,
return EINVAL;

va_start(ap, fmt);

if (!sess->st && !sess->awaiting_answer && !sess->established)
err = sip_replyf(sess->sip, sess->msg, scode, reason,
fmt ? "%v" : NULL, fmt, &ap);
else
err = sip_treplyf(&sess->st, NULL, sess->sip, sess->msg, false,
scode, reason, fmt ? "%v" : NULL, fmt, &ap);

err = sip_treplyf(&sess->st, NULL, sess->sip, sess->msg, false,
scode, reason, fmt ? "%v" : NULL, fmt, &ap);
va_end(ap);

return err;
Expand Down
4 changes: 2 additions & 2 deletions src/sipsess/reply.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ int sipsess_reply_2xx(struct sipsess *sess, const struct sip_msg *msg,
reply->msg = mem_ref((void *)msg);
reply->sess = sess;

sip_contact_set(&contact, sess->cuser, &msg->dst, msg->tp);

is_prack = !pl_strcmp(&msg->met, "PRACK");
sip_contact_set(&contact, sess->cuser, &msg->dst, msg->tp);

err = sip_treplyf(is_prack ? NULL : &sess->st, &reply->mb, sess->sip,
msg, true, scode, reason,
Expand Down Expand Up @@ -143,6 +142,7 @@ int sipsess_reply_2xx(struct sipsess *sess, const struct sip_msg *msg,
if (err) {
if (!is_prack)
sess->st = mem_deref(sess->st);

mem_deref(reply);
}

Expand Down

0 comments on commit 20c7f26

Please sign in to comment.