CBSP: Fix encoding of warning period

The warning period encoding was wrong, resulting in way too short
warning periods being encoded than intended/specified by the caller.

Change-Id: Idf3cae48a6ab45550d7bbd937bb49a0e1a4e8aed
This commit is contained in:
Harald Welte 2021-02-22 10:05:05 +01:00
parent 48f22b0e87
commit fcbf3470b9
1 changed files with 4 additions and 4 deletions

View File

@ -130,13 +130,13 @@ static int encode_wperiod(uint32_t secs)
if (secs <= 10)
return secs;
if (secs <= 30)
return (secs-10)/2;
return 10 + (secs-10)/2;
if (secs <= 120)
return (secs-30)/5;
return 30 + (secs-30)/5;
if (secs <= 600)
return (secs-120)/10;
return 120 + (secs-120)/10;
if (secs <= 60*60)
return (secs-600)/30;
return 600 + (secs-600)/30;
osmo_cbsp_errstr = "warning period out of range";
return -1;
}