diff options
author | Michael P. Soulier <msoulier@digitaltorque.ca> | 2021-05-18 09:58:54 -0400 |
---|---|---|
committer | Michael P. Soulier <msoulier@digitaltorque.ca> | 2021-05-18 09:58:54 -0400 |
commit | fd3692188bd1c12e96b980ad147c04c1bd0fbaad (patch) | |
tree | 630873e9134eec2e866047ce3ccd0743b5e592d0 | |
parent | 08cf5909b0497ca18c218a7131f77d5761700cf1 (diff) | |
download | tftpy-fd3692188bd1c12e96b980ad147c04c1bd0fbaad.tar.gz |
Merged PR 117
-rw-r--r-- | t/test.py | 14 | ||||
-rw-r--r-- | tftpy/TftpShared.py | 2 |
2 files changed, 12 insertions, 4 deletions
@@ -185,7 +185,11 @@ class TestTftpyState(unittest.TestCase): else: server.listen('localhost', 20001) - def clientServerDownloadOptions(self, options, output='/tmp/out'): + def clientServerDownloadOptions(self, + options, + output='/tmp/out', + cretries=tftpy.DEF_TIMEOUT_RETRIES, + sretries=tftpy.DEF_TIMEOUT_RETRIES): """Fire up a client and a server and do a download.""" root = os.path.dirname(os.path.abspath(__file__)) server = tftpy.TftpServer(root) @@ -199,13 +203,14 @@ class TestTftpyState(unittest.TestCase): try: time.sleep(1) client.download('640KBFILE', - output) + output, + retries=cretries) finally: os.kill(child_pid, 15) os.waitpid(child_pid, 0) else: - server.listen('localhost', 20001) + server.listen('localhost', 20001, retries=sretries) @contextmanager def dummyServerDir(self): @@ -223,6 +228,9 @@ class TestTftpyState(unittest.TestCase): def testClientServerNoOptions(self): self.clientServerDownloadOptions({}) + def testClientServerNoOptionsRetries(self): + self.clientServerDownloadOptions({}, cretries=5, sretries=5) + def testClientServerTsizeOptions(self): self.clientServerDownloadOptions({'tsize': 64*1024}) diff --git a/tftpy/TftpShared.py b/tftpy/TftpShared.py index 734b263..7f618e9 100644 --- a/tftpy/TftpShared.py +++ b/tftpy/TftpShared.py @@ -9,7 +9,7 @@ DEF_BLKSIZE = 512 MAX_BLKSIZE = 65536 SOCK_TIMEOUT = 5 MAX_DUPS = 20 -DEF_TIMEOUT_RETRIES = 5 +DEF_TIMEOUT_RETRIES = 3 DEF_TFTP_PORT = 69 # A hook for deliberately introducing delay in testing. |