CPU and RAM consumption

Teddy Hogeborn teddy at recompile.se
Tue Jan 21 22:27:43 CET 2020


Teddy Hogeborn <teddy at recompile.se> writes:

> You could try this patch and report back:
>
> --- mandos	2019-09-03 19:06:41 +0000
> +++ mandos	2020-01-21 21:12:33 +0000
> @@ -88,6 +88,7 @@
>  import ctypes.util
>  import xml.dom.minidom
>  import inspect
> +import random
>  
>  if sys.version_info.major == 2:
>      __metaclass__ = type
> @@ -1037,7 +1038,7 @@
>          if self.checker_initiator_tag is not None:
>              GLib.source_remove(self.checker_initiator_tag)
>          self.checker_initiator_tag = GLib.timeout_add(
> -            int(self.interval.total_seconds() * 1000),
> +            int(random.range(self.interval.total_seconds()+1) * 1000),
>              self.start_checker)
>          # Schedule a disable() when 'timeout' has passed
>          if self.disable_initiator_tag is not None:

Typo fix; the function is "randrange()", not "range()":

=== modified file 'mandos'
--- mandos	2019-12-04 23:35:08 +0000
+++ mandos	2020-01-21 21:25:53 +0000
@@ -78,6 +78,7 @@
 import collections
 import codecs
 import unittest
+import random
 
 import dbus
 import dbus.service
@@ -1035,7 +1036,8 @@
         if self.checker_initiator_tag is not None:
             GLib.source_remove(self.checker_initiator_tag)
         self.checker_initiator_tag = GLib.timeout_add(
-            int(self.interval.total_seconds() * 1000),
+            int(random.randrange(self.interval.total_seconds() + 1)
+                * 1000),
             self.start_checker)
         # Schedule a disable() when 'timeout' has passed
         if self.disable_initiator_tag is not None:

/Teddy Hogeborn

-- 
The Mandos Project
https://www.recompile.se/mandos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://mail.recompile.se/pipermail/mandos-dev/attachments/20200121/08254961/attachment.sig>


More information about the Mandos-Dev mailing list