summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael P. Soulier <msoulier@digitaltorque.ca>2011-07-23 20:05:03 -0400
committerMichael P. Soulier <msoulier@digitaltorque.ca>2011-07-23 20:05:03 -0400
commita43773e26cb056bc1db6392f2ffa9dedcabd4548 (patch)
tree3696a731f21d959d96964477c6acab2702d4ac58
parent1e74abf010088abd4bab27de74778e41393911dd (diff)
downloadtftpy-a43773e26cb056bc1db6392f2ffa9dedcabd4548.tar.gz
Fixing issue #16 on github, server failing to use timeout time in
checkTimeout() method.
-rw-r--r--tftpy/TftpStates.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tftpy/TftpStates.py b/tftpy/TftpStates.py
index 0992d6c..6e6a84c 100644
--- a/tftpy/TftpStates.py
+++ b/tftpy/TftpStates.py
@@ -76,6 +76,7 @@ class TftpContext(object):
self.packethook = None
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.settimeout(timeout)
+ self.timeout = timeout
self.state = None
self.next_block = 0
self.factory = TftpPacketFactory()
@@ -105,9 +106,9 @@ class TftpContext(object):
def checkTimeout(self, now):
"""Compare current time with last_update time, and raise an exception
- if we're over SOCK_TIMEOUT time."""
+ if we're over the timeout time."""
log.debug("checking for timeout on session %s" % self)
- if now - self.last_update > SOCK_TIMEOUT:
+ if now - self.last_update > self.timeout:
raise TftpTimeout, "Timeout waiting for traffic"
def start(self):