Skip to content

Commit

Permalink
sipreg/reg.c: stop retrying registers early after 401/407
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianfridrich committed Jun 14, 2024
1 parent 47a5d9a commit c2a090d
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 c2a090d

Please sign in to comment.