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):