Change in osmo-trx[master]: trx_rate_ctr: Fix immediate rescheduling on per-sec thresholds

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Jun 29 16:33:09 UTC 2020


pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/19049 )

Change subject: trx_rate_ctr: Fix immediate rescheduling on per-sec thresholds
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/c/osmo-trx/+/19049/1/CommonLibs/trx_rate_ctr.cpp 
File CommonLibs/trx_rate_ctr.cpp:

https://gerrit.osmocom.org/c/osmo-trx/+/19049/1/CommonLibs/trx_rate_ctr.cpp@263 
PS1, Line 263: 	threshold_timer_sched_secs = OSMO_MAX((int)(min_secs / 2 - 1), 1);
> I think you need to cast 'min_secs' before the operation, otherwise you're still getting an unsigned […]
The fix is right as it is, I tested it with a debugger.

case: min_secs = 1

OSMO_MAX(1/2-1, 1) -> OSMO_MAX(-1, 1), but -1 is actually encoded as an unsigned because min_secs is an unsigned, so it's actually SIZE_MAX and then the comparison instruction used by the compiler is unsigned. And when SIZE_MAX is stored in threshold_timer_sched_secs, it becomes -1 because the variable is an integer.

And calling schedule(-1,0), seems to work the same as schedule(0,0).



-- 
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/19049
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I6ea3d64dff189a5bc924e72d846e02d50536a8ea
Gerrit-Change-Number: 19049
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Comment-Date: Mon, 29 Jun 2020 16:33:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200629/93090f16/attachment.htm>


More information about the gerrit-log mailing list