Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 4/4] auto-t: fix agent path timing issue
Date: Tue, 03 Nov 2020 11:06:41 -0800	[thread overview]
Message-ID: <20201103190641.2736204-4-prestwoj@gmail.com> (raw)
In-Reply-To: <20201103190641.2736204-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

The agent path was generated based on the current time which
sometimes yielded duplicate paths if agents were created quickly
after one another. Instead a simple iterator removes any chance
of a duplicate path.
---
 autotests/util/iwd.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 7b08c23e..3ffd9f23 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -705,17 +705,22 @@ class OrderedNetwork(object):
                         str(self.signal_strength)) + '\n'\
                 '\tObject: \n' + self.network_object.__str__('\t\t')
 
+agent_count = 0
 
 class PSKAgent(dbus.service.Object):
 
     def __init__(self, passphrases=[], users=[]):
+        global agent_count
+
         if type(passphrases) != list:
             passphrases = [passphrases]
         self.passphrases = passphrases
         if type(users) != list:
             users = [users]
         self.users = users
-        self._path = '/test/agent/' + str(int(round(time.time() * 1000)))
+        self._path = '/test/agent/%s' % agent_count
+
+        agent_count += 1
 
         dbus.service.Object.__init__(self, dbus.SystemBus(), self._path)
 
-- 
2.26.2

  parent reply	other threads:[~2020-11-03 19:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 19:06 [PATCH 1/4] ap: make APRanges optional James Prestwood
2020-11-03 19:06 ` [PATCH 2/4] auto-t: fix testNetconfig hardcoded interface James Prestwood
2020-11-03 19:06 ` [PATCH 3/4] auto-t: remove /var/lib/iwd references in testKnownNetworks James Prestwood
2020-11-03 19:06 ` James Prestwood [this message]
2020-11-03 19:59 ` [PATCH 1/4] ap: make APRanges optional Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201103190641.2736204-4-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox