Skip to content

Commit

Permalink
mid_registrar: Add request retransmission detection
Browse files Browse the repository at this point in the history
Instead of leaking shared memory on scripts which do not properly call
t_check_trans() beforehand, mid_registrar_save() will now act as a
t_check_trans() call and perform a default processing of the
retransmission.

Fixes #1907

(cherry picked from commit 2a4290d)
  • Loading branch information
liviuchircu committed Jan 8, 2020
1 parent 84d45ed commit 86b0c94
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/mid_registrar/save.c
Expand Up @@ -1519,7 +1519,7 @@ void mid_reg_resp_in(struct cell *t, int type, struct tmcb_params *params)
struct sip_msg *req = params->req;
int code = rpl->first_line.u.reply.statuscode;

LM_DBG("request -------------- \n%s\nxxx: \n", req->buf);
LM_DBG("request -------------- \n%s\n", req->buf);
LM_DBG("reply: %d -------------- \n%s\n", code, rpl->buf);

lock_start_write(mri->tm_lock);
Expand Down Expand Up @@ -2294,6 +2294,11 @@ int mid_reg_save(struct sip_msg *msg, udomain_t *ud, str *flags_str,
return -1;
}

if (((int (*)(struct sip_msg *))tm_api.t_check_trans)(msg) == 0) {
LM_INFO("absorbing retransmission, use t_check_trans() earlier!\n");
return 0;
}

rerrno = R_FINE;
memset(&sctx, 0, sizeof sctx);

Expand Down

0 comments on commit 86b0c94

Please sign in to comment.