Skip to content

Commit

Permalink
sipreg/reg.c: stop retrying registers early after 401/407 (#1143)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianfridrich authored Jun 19, 2024
1 parent f723cc4 commit 1bf05d8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sipreg/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ static void response_handler(int err, const struct sip_msg *msg, void *arg)
{
const struct sip_hdr *minexp;
struct sipreg *reg = arg;
uint16_t last_scode = reg->ls.last_scode;

reg->wait = failwait(reg->failc + 1);
if (err || !msg || sip_request_loops(&reg->ls, msg->scode)) {
Expand Down Expand Up @@ -223,6 +224,11 @@ static void response_handler(int err, const struct sip_msg *msg, void *arg)

case 401:
case 407:
if (reg->ls.failc > 1 && last_scode == msg->scode) {
reg->failc++;
goto out;
}

sip_auth_reset(reg->auth);
err = sip_auth_authenticate(reg->auth, msg);
if (err) {
Expand Down

0 comments on commit 1bf05d8

Please sign in to comment.