lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241112173843.2831e918@kernel.org>
Date: Tue, 12 Nov 2024 17:38:43 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Donald Hunter <donald.hunter@...il.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon
 Horman <horms@...nel.org>, Xiao Liang <shaw.leon@...il.com>, Jiri Pirko
 <jiri@...nulli.us>, donald.hunter@...hat.com
Subject: Re: [PATCH net-next v2 2/2] tools/net/ynl: add async notification
 handling

some comments for your consideration, if you prefer to keep as is:

Acked-by: Jakub Kicinski <kuba@...nel.org>

On Tue, 12 Nov 2024 11:17:27 +0000 Donald Hunter wrote:
> +    def poll_ntf(self, duration=None):
> +        endtime = time.time() + duration if duration is not None else None

we can record starttime here, and avoid the complex logic..

> +        selector = selectors.DefaultSelector()
> +        selector.register(self.sock, selectors.EVENT_READ)
> +
> +        while True:
> +            try:
> +                yield self.async_msg_queue.get_nowait()
> +            except queue.Empty:
> +                if endtime is not None:
> +                    interval = endtime - time.time()

then here:

		if duration is not None:
			timeout = time.time() - starttime + duration

and rest as is (modulo the s/interval/timeout/)

> +                    if interval <= 0:
> +                        return
> +                else:
> +                    interval = None
> +                events = selector.select(interval)
> +                if events:
> +                    self.check_ntf()

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ