parent
1e74abf010
commit
a43773e26c
|
@ -76,6 +76,7 @@ class TftpContext(object):
|
||||||
self.packethook = None
|
self.packethook = None
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
self.sock.settimeout(timeout)
|
self.sock.settimeout(timeout)
|
||||||
|
self.timeout = timeout
|
||||||
self.state = None
|
self.state = None
|
||||||
self.next_block = 0
|
self.next_block = 0
|
||||||
self.factory = TftpPacketFactory()
|
self.factory = TftpPacketFactory()
|
||||||
|
@ -105,9 +106,9 @@ class TftpContext(object):
|
||||||
|
|
||||||
def checkTimeout(self, now):
|
def checkTimeout(self, now):
|
||||||
"""Compare current time with last_update time, and raise an exception
|
"""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)
|
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"
|
raise TftpTimeout, "Timeout waiting for traffic"
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
|
Reference in New Issue