Fixed long standing bug with hit_count
authorAndrew DeFaria <Andrew@DeFaria.com>
Sat, 13 Jan 2018 17:21:20 +0000 (09:21 -0800)
committerAndrew DeFaria <Andrew@DeFaria.com>
Sat, 13 Jan 2018 17:21:20 +0000 (09:21 -0800)
commitec9dcaa8edb34b1d8be0ce254423294f01ae48ab
treeef48115a84c45e3fad499f7e50a8d9c93736c250
parente01a0154aa68c56ffa206646041ea7a965ad93cc
Fixed long standing bug with hit_count

Seems I had a long standing bug with hit_count getting incremented each
time we checked if a sender was on a list. The On<list>List functions not
only checked if the sender was on the list but also, as a side effect,
incremented hit_count. But we didn't get another hit, we were simply
checking if this sender was on this list. The solution, semi kludgy, was
to add an option $update parameter. If true we update the hit_counter.
Also if unspecified we will default it to true and update the hit_counter.
But if we call these routines with $update set to false we won't update
hit_counter. Then change the places were we just want to check if on this
list to explicitly pass in false.

This bug reared it's head when I implemented the displaying of the rule
information in detail.cgi. In order to get the rule information I was
calling these On<list>List routines and suddenly I was seeing abnormally
high numbers of hits on just added nulllist entries. IOW I was calling
these routines more frequently and they were updating hit_count more
frequently so the bug got exposed. Note that this bug also was triggered
when calling checkaddress and checkaddress.cgi but since that was
infrequently done I didn't notice it.
maps/bin/MAPS.pm
maps/bin/MAPSDB.pm
maps/bin/checkaddress.cgi
maps/bin/detail.cgi