Fixing issue #16 on github, server failing to use timeout time in

checkTimeout() method.
master
Michael P. Soulier 2011-07-23 20:05:03 -04:00
parent 1e74abf010
commit a43773e26c
1 changed files with 3 additions and 2 deletions

View File

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